Skip to content
TT - Childcare Costs
library(tidyverse)childcare_costs <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-05-09/childcare_costs.csv')
counties <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-05-09/counties.csv')colnames(childcare_costs)data_ny <- childcare_costs %>%
filter(county_fips_code > 36000 & county_fips_code < 37000)head(data_ny, 25)data_ny %>%
ggplot(aes(x = study_year, y = unr_16)) +
geom_line() +
labs(x = "", y = "") +
facet_wrap(~ as.factor(county_fips_code)) +
theme_minimal() +
theme(legend.position = "none") +
ggtitle("Unemployment Rate (2008 - 2018)") +
theme(axis.text.x = element_blank(), axis.ticks.x = element_blank())head(counties)# Joining the ny_data dataframe with the counties dataframe by county_fips_code and removing "County" from every county_name
data_ny <- data_ny %>%
inner_join(counties, by = 'county_fips_code')
data_ny <- data_ny %>%
mutate(county_name = gsub(" County", "", county_name, fixed = TRUE))head(data_ny, 25)data_ny %>%
ggplot(aes(x = study_year, y = unr_16)) +
geom_line() +
labs(x = "Year", y = "") +
facet_wrap(~ as.factor(county_name)) +
theme_minimal() +
theme(legend.position = "none") +
ggtitle("Unemployment Rate (2008 - 2018)") +
theme(axis.text.x = element_blank(), axis.ticks.x = element_blank())data_nyc <- data_ny %>%
filter(county_name %in% c('Bronx', 'New York', 'Kings', 'Richmond', 'Queens'))data_nyc <- data_nyc %>%
mutate(county_name = case_when(
county_fips_code == 36047 ~ "Brooklyn",
county_fips_code == 36061 ~ "Manhattan",
county_fips_code == 36085 ~ "Staten Island",
TRUE ~ county_name
))
head(data_nyc)nyc_2018 <- data_nyc %>%
filter(study_year == 2018)
head(nyc_2018)I set a color palette that is considerate of color blindness. Iuse the scale_color_viridis_d() function from the viridis package, which provides color palettes that are perceptually uniform in both color and black-and-white. They are also designed to be perceived by viewers with typical or atypical color vision.
library(viridis)