Validate that dataset has unique rows for key variables
validate_one_row_per_id.Rd
Usage
validate_one_row_per_id(x, key = c("USUBJID", "STUDYID"))
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)
}