validate_has_data | R Documentation |
validate_has_data(
x,
min_nrow = NULL,
complete = FALSE,
allow_inf = TRUE,
msg = NULL
)
x |
( |
min_nrow |
( |
complete |
( |
allow_inf |
( |
msg |
( |
This function is a wrapper for shiny::validate
.
library(teal)
ui <- fluidPage(
sliderInput("len", "Max Length of Sepal",
min = 4.3, max = 7.9, value = 5
),
plotOutput("plot")
)
server <- function(input, output) {
output$plot <- renderPlot({
iris_df <- iris[iris$Sepal.Length <= input$len, ]
validate_has_data(
iris_df,
min_nrow = 10,
complete = FALSE,
msg = "Please adjust Max Length of Sepal"
)
hist(iris_df$Sepal.Length, breaks = 5)
})
}
if (interactive()) {
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.