I am trying to generate a html report from a runtime Shiny flexdashboard app. I'm running into 2 issues:
- when I use the params feature example, I have no idea how to select the parameters,
- when I use the other example where it seems I don't need to pass parameters it produces a rmd document but pandoc doesn't work to convert it.
I'd rather use option 2. any ideas? Here is the error I'm getting:
This is the chunk I'm using for download report:
output$report <- downloadHandler(
filename = function() {
paste('my-report', sep = '.', switch(
input$format, PDF = 'pdf', HTML = 'html', Word = 'docx'
))
},
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)
}
)