validate_has_variable | R Documentation |
validate_has_variable(data, varname, msg)
data |
( |
varname |
( |
msg |
( |
This function is a wrapper for shiny::validate
.
data <- data.frame(
one = rep("a", length.out = 20),
two = rep(c("a", "b"), length.out = 20)
)
ui <- fluidPage(
selectInput(
"var",
"Select variable",
choices = c("one", "two", "three", "four"),
selected = "one"
),
verbatimTextOutput("summary")
)
server <- function(input, output) {
output$summary <- renderText({
validate_has_variable(data, input$var)
paste0("Selected treatment variables: ", paste(input$var, collapse = ", "))
})
}
if (interactive()) {
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.