Skip to contents

[Stable]

Usage

validate_one_row_per_id(x, key = c("USUBJID", "STUDYID"))

Arguments

x

a data.frame

key

a vector of ID variables from x that identify unique records

Details

This function is a wrapper for shiny::validate.

Examples

library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl

ui <- fluidPage(
  sliderInput("obs", "Max Age",
    min = 0, max = 100, value = 50
  ),
  verbatimTextOutput("age_summary")
)

server <- function(input, output) {
  output$age_summary <- renderText({
    ADSL_f <- ADSL[ADSL$AGE <= input$obs, ]
    validate_one_row_per_id(ADSL_f, key = c("STUDYID"))

    paste0("Mean age :", mean(ADSL_f$AGE))
  })
}
if (FALSE) {
shinyApp(ui, server)
}