Я пытаюсь включить validate
в моем приложении Shiny для отображения сообщения об ошибке, когда выбранные входы приводят к пустому фрейму данных.
# Function to construct df used in the plot
df_construction <- function(selected_month, selected_variable){
airquality %>%
dplyr::filter(Month == selected_month,
!is.na(!!rlang::sym(selected_variable)))%>%
select(Month, Day, selected_variable)
}
# Populate df with the inputs selected
df1 <- reactive({
df_construction(input$month_select, selected_variable())
})
# Plot
output$plot <- renderPlotly({
validate(
need(
expr = !empty(df1()),
message = "There is no data for this Month-variable combination. \n Please make a different choice.")
)
plots <- double_plotting(input$month_select, selected_variable()) # This is a function to plot
plots
})
input$month_select
происходит от pickerInput
selected_variable()
- это реактивный переключатель, вход которого тоже pickerInput
.
Я получаю следующую ошибку:
Warning: Error in : 'validate' is defunct.
Use 'geojsonlint::geojson_lint()' instead.
See help("Defunct")
Я попытался использовать geojson_lint, но безуспешно.