library(tidyverse)
library(sf) # fix annoying tidyverse tibble issue with sfc_MULTIPOLYGON
library(clipr)
import tables from our cleaned data. We’ll need both our county-only table and all-terminations
county_terminations_2020 <- read_rds("data-processed/01-county-terminations-2020.rds")
county_terminations_2020 %>% arrange(total_terminations %>% desc())
Including out of state and unknown counties
all_terminations <- read_rds("data-processed/02-all-terminations.rds") ## table including out of state and country rows
all_terminations %>% arrange(year)
total_terminations <- read_rds("data-processed/03-itop-totals.rds")
total_terminations
What counties had the highest rates in 2020?
terminations_rates_2020 <- county_terminations_2020 %>%
arrange(
terminations_per_pop %>% desc()
)
terminations_rates_2020
terminations_rates_2020_plot <- terminations_rates_2020 %>%
ggplot() +
geom_sf(aes(fill = terminations_per_pop), color = "white", size = .2) +
theme_void() +
labs(
title = "Terminations per 1,000 in Texas counties",
caption = "Source: Texas Health and Human Services"
) +
scale_fill_distiller(
palette = "Greens",
direction = 1,
name = "Cases per 1000"
) +
theme(plot.margin = unit(c(10,0,10,0), "pt"))
terminations_rates_2020_plot
Select only the data we need so we can clean it up and export for datawrapper
datawrapper_rates <- terminations_rates_2020 %>%
rename(
county = name
) %>%
mutate(
county = str_to_title(county)
) %>%
select(
county,
geoid,
terminations_per_pop
) %>%
arrange(county)
datawrapper_rates %>% write_csv("data-processed/datawrapper.csv") # export to csv so we can hackily get rid of geometry in the next step
data_wrapper_clean <- read_csv("data-processed/datawrapper.csv") %>%
select(-geometry) # get rid of geometry
## Rows: 254 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): county, geometry
## dbl (2): geoid, terminations_per_pop
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
data_wrapper_clean %>% write_clip(allow_non_interactive = T)
## Warning: One or more parsing issues, see `problems()` for details
Link to datawrapper chart here: 2020 abortion rates
Question: what’s going on in Loving, King, and Terrell counties?
Answer: Loving has a tiny population (64 people), and in 2020 there were 2 abortions performed there. King, with a population of 265 had 1 abortion, and in Terrell (pop 760), there were 3 abortions in 2020.
follow-up question: What were those county’s numbers the other years? Let’s take a look!
county_terminations_2020 %>%
filter(
name == "LOVING" | name == "TERRELL" | name == "KING"
) %>%
group_by(name)
Let’s look at how these counties rank in terms of size compared to other counties
county_terminations_2020 %>%
arrange(total_pop)
Takeways:
Loving’s 2020 rate was definitely a fluke, but Terrell has had relatively high rates of 8 (2017), 5 (2018), and 4 (2020) which is kind of interesting given there isn’t an abortion clinic there. King had a rate of 4 for both 2020 and 2019, but rates of zero for the three years prior.
Interestingly, all three counties are in the 10 least-populace counties of Texas: Loving ranking #1 least-populace, King #2 least-populous, and Terrell #7.
How have the number of abortions changed over the ten years, if at all? Analyze then copy for datawrapper
terminations_over_time <- all_terminations %>%
group_by(year) %>%
summarise(total_terminations = sum(total_terminations)) # get total terminations by year
terminations_over_time %>% write_clip(allow_non_interactive = T) # for datawrapper
terminations_over_time
ggplot(terminations_over_time, aes(x = year, y = total_terminations)) + # set x and y axis
geom_col(aes(fill = year)) + # add columns
labs(
title = "Abortions Trends over the last Decade",
subtitle = "Before the 6 week ban, abortions in Texas had decline nearly 30% over the last decade",
caption = "By Ana Goodwin",
x = "Year",
y = "Total Terminations"
)
Texas abortions have stayed pretty consistent the last 5 years, only fluctuating by around 3,400. However, abortions have steadily been dropping over time. They have dropped by 28% since 2010.
Analyze the following:
terminations_by_race <- all_terminations %>%
select(
-(total_terminations:age_not_stated) #get rid of age columns
) %>%
pivot_longer(
cols = asian:race_not_stated, # select columns to pivot
names_to = "race", # new column name
values_to = "terminations"
) %>%
mutate(
race = recode(
race,
"other" = "other/unknown",
"race_not_stated" = "other/unknown",
"native_american" = "native american"
)
) %>%
group_by(year, race) %>% # group by race
summarise(
total_terminations = sum(terminations) # add all the termination counts together
)
## `summarise()` has grouped output by 'year'. You can override using the `.groups` argument.
terminations_by_race
ggplot(terminations_by_race, aes(x = year, y = total_terminations)) + # set x and y axis
geom_line(aes(group = race, color = as.character(race))) + # split lines and set colors
labs(
title = "Texas Abortions By Race",
subtitle = "Reported abortions performed on Texas residents for the years 2016-2020",
x = "Year",
y = "Total terminations",
color = "Year", # fix the title for the legend
caption = "Source: Texas Health and Human Services"
)
The race data would be better represented by a bar chart
ggplot(terminations_by_race, aes(x = year, y = total_terminations, fill = race)) +
geom_bar(stat = "identity") +
guides(fill = guide_legend(title = "Race/Ethnicity"))
To make a grouped bar chart for datawrapper, we need to have this be in a slightly different form
terminations_by_race_datawrapper <- terminations_by_race %>%
pivot_wider(
names_from = race, values_from = total_terminations
)
terminations_by_race_datawrapper %>% write_clip(allow_non_interactive = T)
Link to datawrapper chart here: abortions by race
Below are some data points pulled from the American Community Survey 5-year estimates from the U.S. Census Bureau for some additional context.
Texas female population demographics:
First let’s get the total number of reported abortions on Texans out of state
all_terminations %>%
filter(
county == "OTHER STATE"
) %>%
group_by(year) %>%
summarise(
OOS_terminations = sum(total_terminations) # add all the termination counts together for Out of State (OOS) totals
)
takeaway: for 2020, there were 1124 reported terminations performed on Texas residents. In 2019, less women had abortions performed in different states with 1074.
Let’s see what groups what share of out of state terminations each group had
all_terminations %>%
filter(
county == "OTHER STATE"
) %>%
select(
-(total_terminations:age_not_stated) #get rid of age columns
) %>%
pivot_longer(
cols = asian:race_not_stated, # select columns to pivot
names_to = "race", # new column name
values_to = "terminations"
) %>%
mutate(
race = recode(
race,
"other" = "other/unknown",
"race_not_stated" = "other/unknown",
"native_american" = "native american"
)
) %>%
group_by(year, race) %>% # group by race
summarise(
total_terminations = sum(terminations) # add all the termination counts together
)
## `summarise()` has grouped output by 'year'. You can override using the `.groups` argument.
Follow up question for interviews: how does TX HHS handle reporting from other states? (AKA how much can we trust this data and how complete is it?)
Takeaways: - Total terminations performed in different states: 1124 - Hispanic OOS abortions: 120 (10.6%) - Black OOS abortions: 543 (48%) - White OOS abortions: 402 (35.6%)