【发布时间】:2017-08-05 09:35:57
【问题描述】:
我想在 shinyapp 输出中显示我的完整数据。我的数据集有 31 列宽,但使用 DT::renderDataTable 我最多只能得到 17 列。我需要能够看到或至少能够左右滚动以查看我闪亮的应用程序上的整个数据表。下面是 UI 和 SERVER 代码。
我的问题:这可能吗?或者 DT 包可以在闪亮的应用程序中显示的列数有限制吗?
ui.interface <- fluidPage(title = "Pokemon Analysis",
tabsetPanel(
########### Data table below ##############
tabPanel(title = "Pokemon Go",
# plotOutput("go"),
titlePanel("Pokemon Go"),
# Create a new Row in the UI for selectInputs
fluidRow(
column(4,
selectInput("evostage",
"Evolution Stage:",
c("All",
unique(as.character(dt.pokemon$EvoStage))))
),
column(4,
selectInput("evo",
"Evolution:",
c("All",
unique(as.character(dt.pokemon$EvolutionPips))))
),
column(4,
selectInput("battack",
"Attack:",
c("All",
unique(as.character(dt.pokemon$BaseAttack))))
)
),
# Create a new row for the table.
fluidRow(
DT::dataTableOutput("table")
))
########### Data table above ##############
)
)
下面是我的服务器代码...
server.interface <- function(input, output) {
########### Data table below ##############
output$table <- DT::renderDataTable(DT::datatable({
data <- pokemon
if (input$evostage != "All") {
data <- data[data$EvoStage == input$evostage,]
}
if (input$evo != "All") {
data <- data[data$EvolutionPips == input$evo,]
}
if (input$battack != "All") {
data <- data[data$BaseAttack == input$battack,]
}
data
}))
########### Data table above ##############
}
shinyApp(server = server.interface, ui = ui.interface)
【问题讨论】:
标签: r shiny shinydashboard dt