Description Usage Arguments Value Examples
Export report as template
1 2 3 | report_download_handler(template, server, ..., format = "pdf_document",
filename = paste(Sys.Date(), gsub("\\.[^.]+$", "", template), sep = "-"),
output_options = list(), envir = parent.frame())
|
template |
whisker formatted template rmarkdown file to use as the basis for report generation |
server |
server function to use for code generation |
... |
additional whisker tags to expand using
|
format |
the format to be passed to |
filename |
filename to use for generated file. defaults to base filename of template file |
output_options |
additional options to be passed to
|
envir |
environment in which to construct report downloader callback |
a shiny downloadHandler to manage building and downloading of report
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Not run:
## MyReport.Rmd (in working directory)
# ---
# title: "My Report"
# ---
#
# ```{r initialize_code}
# {{.code}}
# ```
#
# # My Plot
#
# ```{r plot}
# {{plot}}
# ```
library(shiny)
ui <- fluidPage(
selectInput('x', 'x axis', choices = names(mtcars)),
selectInput('y', 'y axis', choices = names(mtcars)),
downloadButton("export", "Download Report"),
plotOutput('plot')
)
srv <- function(input, output, session) {
output$plot <- renderPlot({
plot(x = mtcars[[input$x]],
y = mtcars[[input$y]])
})
output$export <- report_download_handler('MyReport.Rmd', srv)
}
shinyApp(ui, srv)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.