-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
title: "TidyTuesday Week 19: Portal Project" | ||
description: "TidyTuesday: Rodents of Portal Arizona" | ||
twitter-card: | ||
image: "thumbnail.png" | ||
author: | ||
- name: Louise E. Sinks | ||
url: https://lsinks.github.io/ | ||
date: 05-09-2023 | ||
categories: [R, TidyTuesday, R-code, Code-Along, Data-Viz, data validation, exploratory data analysis] # self-defined categories | ||
citation: | ||
url: https://lsinks.github.io/posts/2023-05-09-tidytuesday-childcare/childcare | ||
image: "thumbnail.png" | ||
draft: true # setting this to `true` will prevent your post from appearing on your listing page until you're ready! | ||
--- | ||
|
||
Today's TidyTuesday is about childcare prices. | ||
|
||
```{r} | ||
library(tidyverse) | ||
library(gt) | ||
library(skimr) | ||
``` | ||
|
||
Loading the data in the usual way. | ||
|
||
```{r} | ||
tuesdata <- tidytuesdayR::tt_load(2023, week = 19) | ||
childcare_costs <- tuesdata$childcare_costs | ||
counties <- tuesdata$counties | ||
``` | ||
|
||
There are two data files. The dataframe counties has information about county and state, while childcare_costs has a variety of economic data for each county over several years (2008 - 2018). The two dataframes can be joined on county_fips_code, which is a unique identifier for every county. If you look at the TidyTuesday notes, they actually started out in a single file and were split up. | ||
|
||
```{r} | ||
labor_rates <- childcare_costs %>% | ||
select(study_year, county_fips_code, flfpr_20to64, flfpr_20to64_under6, mc_infant, mfcc_infant ) | ||
``` | ||
|
||
```{r} | ||
labor_rates_2 <- labor_rates %>% | ||
left_join(counties) | ||
``` | ||
|
||
```{r} | ||
#| column: page | ||
my_skim <- skim_with(numeric = sfl(p25 = NULL, p50 = NULL, p75 = NULL)) | ||
my_skim(labor_rates_2) | ||
``` | ||
|
||
Employment gap between all women and women with young children | ||
|
||
```{r} | ||
labor_rates_2 <- labor_rates_2 %>% | ||
mutate(gap = flfpr_20to64 - flfpr_20to64_under6) | ||
``` | ||
|
||
average cost of infant care | ||
|
||
```{r} | ||
labor_rates_2 <- labor_rates_2 %>% | ||
mutate(cost = (mc_infant + mfcc_infant)/2) | ||
``` | ||
|
||
plot gap vs. cost for 2018 | ||
|
||
```{r} | ||
labor_rates_2 %>% | ||
# filter(study_year == 2018) %>% | ||
ggplot(aes(cost, gap, color = study_year)) + | ||
geom_point() + geom_smooth() | ||
``` | ||
|
||
correlation | ||
|
||
```{r} | ||
labor_rates_2_2018 <- labor_rates_2 %>% | ||
filter(study_year == 2018) | ||
cor(labor_rates_2_2018$gap, labor_rates_2_2018$cost, use = "pairwise.complete.obs") | ||
``` |