Hi all,
I am working on a business problem where I would like to filter data from a database in a shiny app based on user-supplied input from a list.
Here is the snippet of what works only after collecting the data from a database, which is computationally expensive.
reactive({
my_database_data %>%
collect() %>%
filter(
if (!!input$list != 'All')
(branch == !!input$list
) else TRUE)
})
I would like to achieve the same but doing so straight from the database.
reactive({
my_database_data %>%
filter(
if (!!input$list != 'All')
(branch == !!input$list
) else TRUE)
})
Not too sure of the if-else statement above.