Here is the famous example of shinyapp on Rstudio main page.
ui.R define two tabPanels in the webpage.The first tab renders a map, and the second tab if for selecting date from a full datetable according to the selectInput.
part of the code:
...
tabPanel("Data explorer",
fluidRow(
column(3,
selectInput("states", "States", c("All states"="", structure(state.abb, names=state.name), "Washington, DC"="DC"), multiple=TRUE)
),
column(3,
conditionalPanel("input.states",
selectInput("cities", "Cities", c("All cities"=""), multiple=TRUE)
)
),
column(3,
conditionalPanel("input.states",
selectInput("zipcodes", "Zipcodes", c("All zipcodes"=""), multiple=TRUE)
)
)
),
fluidRow(
column(1,
numericInput("minScore", "Min score", min=0, max=100, value=0)
),
column(1,
numericInput("maxScore", "Max score", min=0, max=100, value=100)
)
),
hr(),
DT::dataTableOutput("ziptable")
),
...
-
I don't know which line of code define the variables,
state.nameandstate.abb, which is used in 4th line of the block above. -
The hierarchy select function is quite simple here. Why can it work without
choicesin the second and thirdselectInputfunction.
Aucun commentaire:
Enregistrer un commentaire