Skip to content

Commit

Permalink
first draft of a tidy tuesday
Browse files Browse the repository at this point in the history
  • Loading branch information
lsinks committed Jun 11, 2023
1 parent adf356d commit c433138
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions posts/2023-05-09-tidytuesday-childcare/childcare.qmd
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")
```

0 comments on commit c433138

Please sign in to comment.