Originally, the code that I’ve been trying to replicate, its data is about flights with any airlines. It means that original data, its transactions happened every day.**
But I would like to apply this code with my data which is about daily sales. However, sometimes, transaction of sales cannot be occurred every day.**
Because of this,
my shiny dashboard hasn’t shown data properly when I clicked day on a bar chart.**
For example, I clicked on second bar (day =4) of November as figure 1, and then it has shown nothing with day 2 as figure 2 (Because “day 2” does not include in my data.**
So, I would like to create some conditions that my dashboard can read date of my data.**
I would appreciate, if someone help me
Thank you so much.
Here this is my full code and data.
#Some part of this code
# Get details (server) --------------------------------------------
get_details <- function(customer = NULL, day = NULL) {
# Create a generic details function that can be called
# by different dashboard events
res <- base_electric()
if (!is.null(customer)) res <- filter(res, Customer == as.character(customer))
if (!is.null(day)) res <- filter(res, day == !!as.integer(day))
res %>%
head(100) %>%
select(
month, day, Customer, cust_name, Quantity, UnitPrice
) %>%
collect() %>%
mutate(month = month.name[as.integer(month)])
}