Description Usage Arguments Examples
Handler for expansion of knitr whisker tags and report generation
1 2 | report_downloader(file, text, format = "pdf_document",
output_options = NULL)
|
file |
the file name to be created |
text |
Rmarkdown file text to use to render notebook. Often the output
of |
format |
the output format to be passed to
|
output_options |
additional output options to be passed to
|
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 37 38 39 40 41 42 43 | ## 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 <- downloadHandler(
filename = 'MyReport.pdf',
content = function(file) report_downloader(
file,
'MyReport.Rmd',
generate_static_code(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.