Validate that dataset has unique rows for key variables
Source:R/validations.R
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
iris$id <- rep(1:50, times = 3)
ui <- fluidPage(
selectInput(
inputId = "species",
label = "Select species",
choices = c("setosa", "versicolor", "virginica"),
selected = "setosa",
multiple = TRUE
),
plotOutput("plot")
)
server <- function(input, output) {
output$plot <- renderPlot({
iris_f <- iris[iris$Species %in% input$species, ]
validate_one_row_per_id(iris_f, key = c("id"))
hist(iris_f$Sepal.Length, breaks = 5)
})
}
if (interactive()) {
shinyApp(ui, server)
}