-
-
Save dgkeyes/009a4ba5201a00023d41fc4fe8d38f72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(readxl) | |
library(janitor) | |
google_forms_raw <- read_excel("data/google-forms-data.xlsx") %>% | |
clean_names() | |
fixed_responses <- c("Slept", "Eaten food", "Cooked food", "Gone to work", "Commuted for work", "Relaxed with a hobby (TELL US THE HOBBY BY TYPING IN THE OTHER FIELD)") | |
google_forms_tidy <- google_forms_raw %>% | |
separate_rows(select_all_the_things_youve_done_in_the_past_24hours, | |
sep = ", ") %>% | |
mutate(things_done_in_last_24hours = case_when( | |
select_all_the_things_youve_done_in_the_past_24hours %in% fixed_responses ~ select_all_the_things_youve_done_in_the_past_24hours, | |
TRUE ~ "Other" | |
)) | |
google_forms_tidy %>% | |
count(things_done_in_last_24hours) %>% | |
ggplot(aes(x = n, | |
y = things_done_in_last_24hours)) + | |
geom_col() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment