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
Examples
library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl
ADRS <- synthetic_cdisc_data("latest")$adrs
ui <- fluidPage(
selectInput(
"rsp",
"Select response parameter",
choices = c("BESRSPI", "INVET", "CBRSPI"),
selected = "BESRSPI",
multiple = FALSE
),
verbatimTextOutput("rsp_summary")
)
server <- function(input, output) {
output$rsp_summary <- renderPrint({
validate_in(input$rsp, ADRS$PARAMCD, "Parameter does not exist.")
nrow(ADRS[ADRS$PARAMCD == input$rsp, ])
})
}
if (FALSE) {
shinyApp(ui, server)
}