validate_in | R Documentation |
validate_in(x, choices, msg)
x |
Vector of values to test. |
choices |
Vector to test against. |
msg |
( |
This function is a wrapper for shiny::validate
.
ui <- fluidPage(
selectInput(
"species",
"Select species",
choices = c("setosa", "versicolor", "virginica", "unknown species"),
selected = "setosa",
multiple = FALSE
),
verbatimTextOutput("summary")
)
server <- function(input, output) {
output$summary <- renderPrint({
validate_in(input$species, iris$Species, "Species does not exist.")
nrow(iris[iris$Species == input$species, ])
})
}
if (interactive()) {
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.