【发布时间】:2018-12-18 07:15:00
【问题描述】:
假设我有一个简单的闪亮应用程序,它返回 DT 表:
library(DT)
ui <- basicPage(
h2("The mtcars data"),
DT::dataTableOutput("mytable")
)
server <- function(input, output) {
output$mytable = DT::renderDataTable({
mtcars
})
}
shinyApp(ui, server)
现在,我有 pdf 文档,我想在最后一列中添加为嵌入式 pdf。 可以说 pdf 文件的名称是 myfile.pdf、myfile2.pdf、myfile3.pdf ...... 我希望表格看起来像
column1...|columnn|pdfdocument
A |b |myfile.pdf
C |d |myfile2.pdf
...
我试过了:
server <- function(input, output) {
mtcars <- cbind(mtcars, tags$embed(srce = "myfile.pdf"))
output$mytable = DT::renderDataTable({
mtcars
})
但它会返回:
cannot coerce class ‘"shiny.tag"’ to a data.frame
如何将可下载的 pdf 文件嵌入到 DT 数据帧中
【问题讨论】: