【发布时间】:2020-02-28 09:03:44
【问题描述】:
有人可以帮助我吗?
我已经尝试查看不同的教程,以及 Stack 上以前的问题/答案。但没有什么能帮到我。
我正在创建一个闪亮的应用程序,它将根据输入值显示不同的输出(数据表)。
到目前为止,这是我的代码:
library(shiny)
library(DT)
# Define UI for miles per gallon app ----
ui <- pageWithSidebar(
# App title ----
headerPanel("Clients per Township - Aggregation"),
# Sidebar panel for inputs ----
sidebarPanel(
helpText("Mean client's penetration (Number of Clients/Number of inhabitants) = 0.0089"),
selectInput("Choice", "Do you want to have a list of townships with client's penetration above or under the mean?", c(" ", "Above","Under"))),
# Main panel for displaying outputs ----
mainPanel(
conditionalPanel(
'input.Choice === "Above"',
DT::dataTableOutput("more_table")
),
conditionalPanel(
'input.Choice === "Under"',
DT::dataTableOutput("less_table")
)
)
)
# Define server logic to plot various variables against mpg ----
server <- function(input, output) {
more_table = DT::renderDataTable({
more_than_mean
})
less_table = DT::renderDataTable({
less_than_mean
})
}
shinyApp(ui, server)
数据表 more_than_mean 和 less_than_mean 是先前计算的。
当我运行应用程序时,我没有收到错误消息。但是没有显示输出。 有人可以帮助我吗?我不明白为什么在我运行应用程序时没有显示这两个表。
谢谢!
【问题讨论】:
标签: r shiny conditional-statements