Parametized Rmarkdown with fileinput on Rstudio Connect

Hi,

I have a parametized Rmarkdown that I published to Rstudio Connect. This report have to read a file (a csv in this example) and show the data. For this example, I use cars and mtcars data save as csv file.

When I run the report on Rstudio Connect with the default data (cars.csv) I have no problem but when I upload a file from my Desktop (mtcars.csv) and run the report, I have an error. Rstudio Connect doesn’t see the tempfile where the csv is supposed to be.

Error: '/opt/rstudio-connect/mnt/tmp/RtmpzIMnJ2/file260711283692/0.csv' does not exist.

I’m using RStudio Connect v1.6.10-3 and R 3-5-1.

The Rmarkdown deployed on Rstudio Connect:

---
title: "Read upload file on Rstudio Connect"
output: html_document
params:
  data:
    label: "Csv Files"
    value: "cars.csv"
    input: file
---

readr::read_csv(params$data)

Any help would be highly appreciated.

Rodrigue

3 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Sorry for the delay here @Rodrigue ! I'm not sure how we missed it!

This is a fantastic question, though! I think what you may want is:

readr::read_csv(params$data$datapath)

This should give you the path to the dataset, as explained in the Shiny fileUpload tool here:

https://shiny.rstudio.com/gallery/file-upload.html

I unfortunately don't have time at the moment to create a reprex, but please open a new question (and link to this one) if that does not work, and we will try to be more attentive! :slight_smile: