output$report <- downloadHandler(
filename = "Modeles_lineaires.docx",
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(), "Modeles_lineaires.Rmd")
file.copy("Modeles_lineaires.Rmd", tempReport, overwrite = TRUE)
# Set up parameters to pass to Rmd document
params <- list(n=input$n,
X_law=input$X_law,
x0=input$x0,
a=input$a,
b=input$b,
s=input$s,
x=values$x,
e=values$e)
# 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())
)
}
)
Forum