Hello,
One of our applications has a couple of apps within it. In the parent directory, we have the app.R and a couple of folders. In one of the folders we have and RMD file that sources other files in other folders ( in child folders). There is a download button that suppose to download an html file produced by the RMD file. In the RMD file, we sources other files such as .RData which is in a child forlder.
The app works find and the download button does what it supposed to do and when we deploy the app to shinyserver it works fine too. However, when we deploy the app to R Studio Connect, the download button does not work.
One solution to the issue was to put all the files that are sourced in RMD in the parent directory and also saving the RMD to a temp file and then override it and use it. This ad hoc solution actually works! Here is a sample of saving it to a temp file,
content = function(file) {
src <- normalizePath('report.Rmd')
# temporarily switch to the temp dir, in case you do not have write
# permission to the current working directory
owd <- setwd(tempdir())
on.exit(setwd(owd))
file.copy(src, 'report.Rmd', overwrite = TRUE)
library(rmarkdown)
out <- render('report.Rmd', switch(
input$format,
PDF = pdf_document(), HTML = html_document(), Word = word_document()
))
file.rename(out, file)
}
This solution works but screw up other parts of the application. The question is, is there a way to fix the referencing (sourcing) files in RMD and be able to get the download button to work without making a major change to the application?
Best
Mo