Download output file in published Rmarkdown document

I am trying to follow the guide linked below for downloading output files from an R Markdown document which is published to RStudio Connect. I can't seem to get my minimal example to work on my institution's internal RStudio Connect. What should I be doing differently?

http://docs.rstudio.com/connect/user/r-markdown.html#r-markdown-output-files

Here is my test document.

---
title: "Test Output File"
output: "html_document"
---
```{r setup, include=FALSE}
fn = 'data.csv'
rmarkdown::output_metadata$set(rsc_output_files = list(fn))
d = data.frame(a=1,b=2)
write.csv(d,file=fn)
```
[`r fn`](`r fn`)
1 Like

Your R Markdown document correctly produces a data.csv and that is made available in the same output directory as the rendered HTML. I took your Rmd, deployed to one our development servers, and can get the CSV file by visiting the link.

Could you confirm your version of the rmarkdown package with packageVersion("rmarkdown") - at least 1.8.6 is required.

Also look at the version of RStudio Connect - output file support was added with version 1.6.4. http://docs.rstudio.com/connect/news/#rstudio-connect-1.6.4

I'm guessing that you are trying to deploy to an older Connect version - an old rmarkdown would err on the output_metadata reference.

Please let us know if you continue to have trouble producing output files.

You were absolutely right. My rmarkdown was up to date, but our RStudio Connect was not. After my sys admin updated, my example works. Thanks!

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