Nothing
Can employees balance collaboration and personal time?
KPI_1 <- my_sq_data %>% create_bar(metric="dailyAfterHours", hrvar= NULL, return="table") %>% select(dailyAfterHours) %>% pull(1) %>% round(1) paste(KPI_1, "hrs after work-hours") %>% flexdashboard::valueBox(icon = "fa-moon", color = rgb2hex(49, 97, 124))
balance2_w1_plot1 <- my_sq_data %>% rename(`After Hours Collaboration` = "dailyAfterHours") %>% create_bar(metric = "After Hours Collaboration", hrvar = hrvar, return = "plot", rank = NULL, bar_colour = rgb2hex(49, 97, 124)) # Need to add mode of communication balance2_w1_plot1 + labs(title = "After hours", subtitle = "Average hours per person per day")
KPI_2 <- my_sq_data %>% create_dist(metric = "dailyAfterHours", hrvar = NULL, return = "table", cut = c(1,2)) if(!("2+ hours" %in% names(KPI_2))){ KPI_2 <- 0 } else { KPI_2 <- KPI_2 %>% pull("2+ hours") %>% .[[1]] %>% round(3) * 100 } paste(KPI_2, "% long after-hours") %>% flexdashboard::valueBox(icon = "fa-calendar-plus", color = "#f59b76")
balance2_w2_plot1 <- my_sq_data %>% rename(`After Hours Collaboration` = "dailyAfterHours") %>% create_dist(metric = "After Hours Collaboration", hrvar = hrvar, return = "plot", cut = c(1,2), dist_colours = c("#f59b76", "#fcf0eb", "#bfe5ee")) balance2_w2_plot1 + labs(title = "After hours distribution", subtitle = "% of employees by daily after hours collaboration")
if(sum(my_sq_data$monthly_weekend_work, na.rm = TRUE) == 0){ KPI_3 <- 0 } else { KPI_3 <- my_sq_data %>% create_bar(metric = "monthly_weekend_work", hrvar = NULL, return="table") %>% pull("monthly_weekend_work") %>% .[[1]] %>% round(3)* 100 } # Need to calculate right KPI paste(KPI_3, "% weekend workers") %>% flexdashboard::valueBox(icon = "fa-calendar-times", color = "#5B0F66")
if(sum(my_sq_data$Frequency_of_weekend_work, na.rm = TRUE) == 0){ md2html("## Note: there is insufficient data to display.") } else { my_sq_data %>% mutate( across(.cols = Frequency_of_weekend_work, .fns = ~ifelse(!is.finite(.), 52, .))) %>% # Assume once a year = Never group_by(!!sym(hrvar), PersonId) %>% summarise( across( .cols = Frequency_of_weekend_work, .fns = ~median(., na.rm = TRUE) ), .groups = "drop" ) %>% group_by(!!sym(hrvar)) %>% summarise( Frequency_of_weekend_work = median(Frequency_of_weekend_work, na.rm = TRUE), n = n_distinct(PersonId) ) %>% filter(n >= 5) %>% ggplot(aes(x = Frequency_of_weekend_work, y = !!sym(hrvar), colour = "Frequency of weekend work")) + geom_point(size = 3) + scale_colour_manual( name="", values = "#5B0F66", # guide = "Frequency of weekend work" ) + scale_x_reverse( limits = c(15, 1), breaks = c(1, 52/12, 52/6, 13), labels = c("Weekly", "Monthly", "Bi-Monthly", "Quarterly"), position = "top" ) + labs(title = "Weekend work", subtitle = "Median frequency of weekend work", caption = extract_date_range(my_sq_data, return = "text")) + theme_wpa_basic() + theme(axis.line.y = element_blank(), axis.ticks = element_blank(), axis.title = element_blank(), panel.grid.major.y = element_line(color="gray"), panel.grid.major.x = element_line(colour = "#D9E7F7", size = 5)) }
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.