I have a shiny app that will allow users to select inputs and is intended to produce a PDF file for printing.
The desired PDF output is not an academic style paper, so I am using Latex/Sweave to create text that wraps around figures, colored headings, etc. The text and R-chunks will reside in a Rnw file that the shiny app will call.
I cannot figure out the commands one would use to process the Rnw file and produce the PDF. As I mentioned, R markdown is too "rigid" for my needs, so I can't use this sort of construction (with the Rmd file specified below):
output$singlePDF <- downloadHandler(
# For PDF output, change this to "report.pdf"
filename <- function(){
paste0(simpleCap(input$unit)," Community Profile ",format(Sys.Date(),"%Y%m%d"), ".pdf")
},
content = function(file) {
# Copy the report file to a temporary directory before processing it, in
# case we don't have write permissions to the current working dir (which
# can happen when deployed).
tempReport <- file.path(tempdir(), "Report.Rmd")
file.copy("Report.Rmd", tempReport, overwrite = TRUE)
# Set up parameters to pass to Rmd document
params <- list(outChk = input$outChk,
listID = idList,
placelist = PlaceList,
level = input$level,
curACS = curACS,
curYr = curYr
)
# Knit the document, passing in the `params` list, and eval it in a
# child of the global environment (this isolates the code in the document
# from the code in this app).
rmarkdown::render(tempReport, output_file = file,
params = params,
envir = new.env(parent = globalenv())
)
}
) # Output singlePDF
Is there an equivalent command to the rmarkdown:render command that will process a Rnw file?
Also, as a side question, are there any tools out there that can make rmarkdown documents more flexible?
Thanks in advance --AB