我有一个闪亮的应用程序,需要在'future'函数中放置RMarkdown :: render,以便其他用户在RMD加载/渲染时继续使用该应用程序。运行应用程序并单击下载按钮时,以下代码可用。但是,当我取消注释新代码,实现未来并运行应用程序时,我收到错误“找不到对象'params'。”
output$snapshot_report_pdf_download <- downloadHandler(
filename = function() {
if(trimws(input$snap_print_pdf_save_name,"both") == "") {
"Portfolio Snapshot Report.pdf"
} else {
paste0(input$snap_print_pdf_save_name, ".pdf")
}
},
content = function(file){
params <- list(
ohf_sh_obj = ohf_sh_obj,
data_date = ohf_sh_obj$data_date,
report = "portfolio_snapshot",
graph = input$snap_print_graphs,
wl_selection_snap = input$wl_selection_snap,
date_selection_snap = input$date_selection_snap,
stacked_snap = input$stacked_snap
)
out <- render('scripts/printing/report_pdf.rmd')
file.rename(out, file)
if (file.exists("scripts/printing/report_pdf.rmd")) {
file.remove("scripts/printing/report_pdf.rmd")
}
# future({render('scripts/printing/report_pdf.rmd',
# params = params)},
# globals = T,
# packages = c("knitr", "rmarkdown")) %...>%
# (function(result) {
# file.rename(result, file)
}
})
非常感谢任何帮助。