Dear all,
I am learning shiny and am trying to write a simple app showing the built-in data sets in a shiny-output. With the code below, I am trying to show the entire table of mtcars or iris in the mainpanel, but in the selectInput pull-down menue, the different atomic vectors of the data sets appear. Instead, I would like to have the entire table rendered. What am I doing wrong here?
Thanks for the help
library(shiny)
ui <- fluidPage(
titlePanel("Datasets of R"),
sidebarLayout(
sidebarPanel(
selectInput(inputId = "builtinTable", label = "Choose Data Set",
choices = list("mtcars" = mtcars,
"iris" = iris))
),
mainPanel(tableOutput(outputId = "ShowMe"))
)
)
server <- function(input, output, session) {
output$ShowMe <- renderTable(input$builtinTable)
}
shinyApp(ui, server)