R 无法在应用程序中显示数据表输出
有人能帮我吗 我已经试着看了不同的教程,以及以前在Stack上的问题/答案。但什么都帮不了我 我正在创建一个闪亮的应用程序,它将根据输入值显示不同的输出(数据表) 以下是我目前的代码:R 无法在应用程序中显示数据表输出,r,shiny,conditional-statements,R,Shiny,Conditional Statements,有人能帮我吗 我已经试着看了不同的教程,以及以前在Stack上的问题/答案。但什么都帮不了我 我正在创建一个闪亮的应用程序,它将根据输入值显示不同的输出(数据表) 以下是我目前的代码: library(shiny) library(DT) # Define UI for miles per gallon app ---- ui <- pageWithSidebar( # App title ---- headerPanel("Clients per Township - Agg
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)
库(闪亮)
图书馆(DT)
#定义每加仑英里数应用程序的用户界面----
ui所以在再次仔细查看我的代码后,我发现了我的(愚蠢的)错误。
我只是忘记了输出表名称前的“ouput$”
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) {
output$more_table = DT::renderDataTable({
more_than_mean
})
output$less_table = DT::renderDataTable({
less_than_mean
})
}
shinyApp(ui, server)
库(闪亮)
图书馆(DT)
#定义每加仑英里数应用程序的用户界面----
用户界面