使用RStudio服务器和闪亮的服务器不会呈现闪亮的数据表

时间:2016-06-23 15:22:19

标签: r shiny dt

我有这个简单的应用程序,从RStudio服务器/ Shiny Server运行时它不会呈现闪亮的数据表,但在桌面RStudio上使用Shiny运行时效果很好:

library(shiny)
library(DT)

ui <- fluidPage(
  dataTableOutput('table1'),
  plotOutput('plot1')
)

server <- function(input, output) {
  output$table1 <- renderDataTable({
    datatable(mtcars)
  })
  output$plot1 <- renderPlot({
    plot(mtcars$wt, mtcars$mpg)
  })
}

shinyApp(ui = ui, server = server)

当我在RStudio服务器控制台中输入datatable(mtcars)时,我确实在查看器中完全可以获得数据表输出。就在我将它作为Shiny应用程序运行时,我遇到了问题。关于可能导致这种情况的任何想法?

packageVersion('DT')
[1] ‘0.1.56’
packageVersion('shiny')
[1] ‘0.13.2’
version
               _                           
platform       x86_64-redhat-linux-gnu     
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          3.0                         
year           2016                        
month          05                          
day            03                          
svn rev        70573                       
language       R                           
version.string R version 3.3.0 (2016-05-03)
nickname       Supposedly Educational

2 个答案:

答案 0 :(得分:0)

此处缺少逗号:

dataTableOutput('table1'),

答案 1 :(得分:0)

请注意Shiny有own renderDataTable,dataTableOutput和dataTable函数。你可以

  1. 尝试删除DT库,因此无论是否调用Shiny或DT函数都不会产生混淆。

  2. 尝试使用DT预先添加每个renderDataTable,dataTableOutput和dataTable函数,以确保始终使用DT变体。

  3. ,例如,

    DT::renderDataTable