Hi!
I have a dynamic app (similar to
this one ) in which I have some cities mapped out, and when the user clicks on a specific city, the app gives them information about it. All the info comes out of a data frame and everything works fine in the app. The thing is, I want the users to be able to download a PDF file specific to the city they clicked on. I have a .Rmd file prepared (as all the PDF's would have the same type of information, except it should be specific to the city, aka density, financial independece, etc.) but I can't find a way to link it to the shiny app, as in make the PDF display the name of the city and all of its specific information. I am able to download a "standard" PDF from the app--non reactive--, but I don't know if it is possible to make it reactive to the shiny app without having to make a specific file for each city?
The code I am using to download the pdf is this (and works fine):
output$downloadpdf <- downloadHandler(
filename= "Report.pdf",
content = function(file) {
out = rmarkdown::render("Report.Rmd")
file.rename(out, file)
},
contentType = 'application/pdf'
)
And if I type this in my .Rmd to display the name of the chosen city (which is the same code I have in my server.R to display the name of the city):
when I try downloading the PDF, it only renders this in a blank page:
"Reading objects from shinyoutput object not allowed rmarkdown"
So, again, is there a way to make my .Rmd (PDF) file reactive to my shiny app??
Thank you for your help!
Margarita