Validates that vector includes all expected values
validate_in.Rd
Arguments
- x
values to test. All must be in
choices
- choices
a vector to test for values of
x
- msg
warning message to display
Details
This function is a wrapper for shiny::validate
.
Examples
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)
}