我正在尝试使用以下代码下载一个包含表格的pdf文件,并将所有图表以单个pdf文件/报告的形式一起显示,但是该代码显示了一些警告。 有人可以通过以下代码或通过任何其他解决方案来帮助我吗?
等待响应
ui.R
library(gplots)
library(reshape2)
library(plotly)
dashboardBody(
downloadButton("report_file", "Generate report")
)
server.R
shinyServer(function(session,input,output){
output$estimatesPK<-renderTable({
table()
})
output$mean_graph<-renderPlot({
plot()
})
output$log_mean_graph({
plot1()
})
output$individual_graph({
plot2()
})
output$log_individual_graph({
plot3()
})
output$T_R_Ratio_Table({
table1()
})
output$report_file <- downloadHandler(
# For PDF output, change this to "report.pdf"
filename = "report_file.pdf",
content = function(file) {
# before processing it,
# in
# .
tempReport <- file.path(tempdir(), "report_file.Rmd")
file.copy("report_file.Rmd", tempReport, overwrite = TRUE)
rmarkdown::render(tempReport, output_file = file,
params = params,
envir = new.env(parent = globalenv())
)
}
)
})
report_file.Rmd
---
title: "Parameterized Report for Shiny"
output: pdf_document
params:
table: 'NULL'
plot: 'NULL'
region: ""
---
params[["estimatesPK"]]
params[["mean_graph"]]
params[["log_mean_graph"]]
params[["individual_graph"]]
params[["log_individual_graph"]]
params[["T_R_Ratio_Table"]]
我尝试了上面的代码,但出现以下错误
Quitting from lines 11-12 (report_file.Rmd)
Warning: Error in eval: object 'params' not found
[No stack trace available]