【发布时间】:2017-12-26 08:26:34
【问题描述】:
这个问题被问到here 并且得到了回答。但是,现在,它对我不起作用。我不确定包裹中是否有任何变化。有什么想法吗?
ui.r
require(shiny)
library(DT)
shinyUI(
DT::dataTableOutput('mytable')
)
服务器.R
library(shiny)
library(DT)
dat <- data.frame(
country = c('USA', 'China'),
flag = c('<img src="http://flaglane.com/download/american-flag/american-
flag-large.png" height="52"></img>',
'<img src="https://upload.wikimedia.org/wikipedia/commons/2/2e/Flag_of_China.png" height="52"></img>'
)
)
shinyServer(function(input, output){
output$mytable <- DT::renderDataTable({
DT::datatable(dat, escape = FALSE)
})
})
编辑
我的感觉是,如果它在 Rstudio 查看器中不起作用,那么当我启动 Shiny 时它也不起作用。然而,我错了。当我运行该应用程序时,它可以正常工作,但在 Rstudio Viewer 中却不行。
library(shiny)
library(DT)
dat <- data.frame(
country = c('USA', 'China'),
flag = c('<img src="http://flaglane.com/download/american-flag/american-
flag-large.png" height="52"></img>',
'<img src="https://upload.wikimedia.org/wikipedia/commons/2/2e/Flag_of_China.png" height="52"></img>'
)
)
DT::datatable(dat, escape = FALSE)
【问题讨论】: