Validates that dataset contains specific variable
validate_has_variable.Rd
Arguments
- data
a data.frame
- varname
name of variable in
data
- msg
message to display if
data
does not includevarname
Details
This function is a wrapper for shiny::validate
.
Examples
library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl
ui <- fluidPage(
selectInput("arm", "Select treatment",
choices = c("ARM", "ARMCD", "ACTARM", "TRT"),
selected = "ARM", multiple = TRUE
),
verbatimTextOutput("arm_summary")
)
server <- function(input, output) {
output$arm_summary <- renderText({
validate_has_variable(ADSL, input$arm)
paste0("Selected treatment variables: ", paste(input$arm, collapse = ", "))
})
}
if (FALSE) {
shinyApp(ui, server)
}