2
光沢のあるDT :: renderDataTableでif条件を使用したいが、正しく動作しない。ここ は、最小限の例です。光沢のあるDTの状態がレンダリング可能な場合
library(DT)
library(shiny)
ui <- shinyUI(fluidPage(
titlePanel(""),
sidebarLayout(
sidebarPanel(radioButtons("button", "", choices=c("a", "b"))),
mainPanel(DT::dataTableOutput("table1"))
)
))
server <- function(input, output){
x <- data.frame(col1 = 1:2, col2 = 3:4, col3 =5:6)
y <- data.frame(col1 = 10:11, col2 = 20:21)
output$table1 <- DT::renderDataTable({
if(input$button == "a"){
datatable(x)
}
if(input$button == "b"){
datatable(y)
}
})
}
shinyApp(ui, server)
「」選ばれたが、「B」が選択されている場合は完全に動作している場合、アプリケーションは、任意の出力を表示しません。 誰かがアイデアを持っていますか?おかげさまで