Skip to content

Commit 6701b96

Browse files
authored
Merge pull request #514 from rfordatascience/2023-07
2023 week 7: Hollywood Age Gaps
2 parents 5938ecb + 4b6b7bf commit 6701b96

File tree

9 files changed

+2025
-0
lines changed

9 files changed

+2025
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Need a **reminder**? There are [extensions](https://chrome.google.com/webstore/d
128128
| 4 | `2023-01-24` | [Alone data](data/2023/2023-01-24/readme.md) | [Alone data package](https://github.com/doehm/alone) | [Alone R package: Datasets from the survival TV series](https://gradientdescending.com/alone-r-package-datasets-from-the-survival-tv-series/) |
129129
| 5 | `2023-01-31` | [Pet Cats UK](data/2023/2023-01-31/readme.md) | [Movebank for Animal Tracking Data](https://www.datarepository.movebank.org/handle/10255/move.882) | [Cats on the Move](https://themarkup.org/data-is-plural/2023/01/25/from-jazz-solos-to-cats-on-the-move#:~:text=Giuseppe%20Sollazzo%5D-,Cats%20on%20the%20move,-.%20Between%202013) |
130130
| 6 | `2023-02-07` | [Big Tech Stock Prices](data/2023/2023-02-07/readme.md) | [Big Tech Stock Prices on Kaggle](https://www.kaggle.com/datasets/evangower/big-tech-stock-prices) | [5 Charts on Big Tech Stocks’ Collapse](https://www.morningstar.com/articles/1129535/5-charts-on-big-tech-stocks-collapse) |
131+
| 7 | `2023-02-14` | [Hollywood Age Gaps](data/2023/2023-02-14/readme.md) | [Hollywood Age Gap](https://hollywoodagegap.com/movies.csv) | [Hollywood Age Gap](https://hollywoodagegap.com/) |
131132

132133
***
133134

data/2023/2023-02-14/age_gaps.csv

Lines changed: 1156 additions & 0 deletions
Large diffs are not rendered by default.

data/2023/2023-02-14/pic1.png

186 KB
Loading

data/2023/2023-02-14/pic2.png

511 KB
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"article_link": "https://hollywoodagegap.com/",
3+
"pic1_alt": "A screenshot from HollywoodAgeGap.com/, plotting ages in years of the members of the primary love interest in each of six films. Male members of the couple are shown as blue squares, and female members as purple circles. The ages are plotted on a number line for each film, and the age is also shown as a large number. The age differences are depicted from highest (Harold and Maude, 1971, 52 years) to lowest out of these six films (Poison Ivy, 1992, 42 years).",
4+
"pic2_alt": "The movie poster for the 1971 film Harold and Maude, with the tagline 'His hangups are hilarious.' The poster shows a cartoon depiction of the younger member of the couple, Harold, holding his tie above his head as if hanging himself."
5+
}

data/2023/2023-02-14/readme.html

Lines changed: 669 additions & 0 deletions
Large diffs are not rendered by default.

data/2023/2023-02-14/readme.md

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
### Please add alt text to your posts
2+
3+
Please add alt text (alternative text) to all of your posted graphics for `#TidyTuesday`.
4+
5+
Twitter provides [guidelines](https://help.twitter.com/en/using-twitter/picture-descriptions) for how to add alt text to your images.
6+
7+
The DataViz Society/Nightingale by way of Amy Cesal has an [article](https://medium.com/nightingale/writing-alt-text-for-data-visualization-2a218ef43f81) on writing _good_ alt text for plots/graphs.
8+
9+
> Here’s a simple formula for writing alt text for data visualization:
10+
> ### Chart type
11+
> It’s helpful for people with partial sight to know what chart type it is and gives context for understanding the rest of the visual.
12+
> Example: Line graph
13+
> ### Type of data
14+
> What data is included in the chart? The x and y axis labels may help you figure this out.
15+
> Example: number of bananas sold per day in the last year
16+
> ### Reason for including the chart
17+
> Think about why you’re including this visual. What does it show that’s meaningful. There should be a point to every visual and you should tell people what to look for.
18+
> Example: the winter months have more banana sales
19+
> ### Link to data or source
20+
> Don’t include this in your alt text, but it should be included somewhere in the surrounding text. People should be able to click on a link to view the source data or dig further into the visual. This provides transparency about your source and lets people explore the data.
21+
> Example: Data from the USDA
22+
23+
Penn State has an [article](https://accessibility.psu.edu/images/charts/) on writing alt text descriptions for charts and tables.
24+
25+
> Charts, graphs and maps use visuals to convey complex images to users. But since they are images, these media provide serious accessibility issues to colorblind users and users of screen readers. See the [examples on this page](https://accessibility.psu.edu/images/charts/) for details on how to make charts more accessible.
26+
27+
The `{rtweet}` package includes the [ability to post tweets](https://docs.ropensci.org/rtweet/reference/post_tweet.html) with alt text programatically.
28+
29+
Need a **reminder**? There are [extensions](https://chrome.google.com/webstore/detail/twitter-required-alt-text/fpjlpckbikddocimpfcgaldjghimjiik/related) that force you to remember to add Alt Text to Tweets with media.
30+
31+
# Hollywood Age Gaps
32+
33+
The data this week comes from [Hollywood Age Gap](https://hollywoodagegap.com/) via [Data Is Plural](https://www.data-is-plural.com/archive/2018-02-07-edition/).
34+
35+
> An informational site showing the age gap between movie love interests.
36+
37+
The data follows certain rules:
38+
39+
> The two (or more) actors play actual love interests (not just friends, coworkers, or some other non-romantic type of relationship)
40+
41+
> The youngest of the two actors is at least 17 years old
42+
43+
> Not animated characters
44+
45+
We previously provided a dataset about the [Bechdel Test](https://tidytues.day/2021/2021-03-09). It might be interesting to see whether there is any correlation between these datasets! The Bechdel Test dataset also included additional information about the films that were used in that dataset.
46+
47+
Note: The age gaps dataset includes "gender" columns, which always contain the values "man" or "woman". These values appear to indicate how the *characters* in each film identify. Some of these values do not match how the *actor* identifies. We apologize if any characters are misgendered in the data!
48+
49+
### Get the data here
50+
51+
```{r}
52+
# Get the Data
53+
54+
# Read in with tidytuesdayR package
55+
# Install from CRAN via: install.packages("tidytuesdayR")
56+
# This loads the readme and all the datasets for the week of interest
57+
58+
# Either ISO-8601 date or year/week works!
59+
60+
tuesdata <- tidytuesdayR::tt_load('2023-02-14')
61+
tuesdata <- tidytuesdayR::tt_load(2023, week = 7)
62+
63+
age_gaps <- tuesdata$age_gaps
64+
65+
# Or read in the data manually
66+
67+
age_gaps <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-14/age_gaps.csv')
68+
```
69+
70+
### Data Dictionary
71+
72+
# `age_gaps.csv`
73+
74+
|variable |class |description |
75+
|:------------------|:---------|:------------------|
76+
|movie_name |character |Name of the film |
77+
|release_year |integer |Release year |
78+
|director |character |Director of the film|
79+
|age_difference |integer |Age difference between the characters in whole years |
80+
|couple_number |integer |An identifier for the couple in case multiple couples are listed for this film |
81+
|actor_1_name |character |The name of the older actor in this couple|
82+
|actor_2_name |character |The name of the younger actor in this couple|
83+
|character_1_gender |character |The gender of the older character, as identified by the person who submitted the data for this couple|
84+
|character_2_gender |character |The gender of the younger character, as identified by the person who submitted the data for this couple|
85+
|actor_1_birthdate |date |The birthdate of the older member of the couple|
86+
|actor_2_birthdate |date |The birthdate of the younger member of the couple|
87+
|actor_1_age |integer |The age of the older actor when the film was released|
88+
|actor_2_age |integer |The age of the younger actor when the film was released|
89+
90+
91+
### Cleaning Script
92+
93+
```r
94+
library(tidyverse)
95+
library(here)
96+
library(janitor)
97+
98+
age_gaps <- read_csv(
99+
"http://hollywoodagegap.com/movies.csv",
100+
) |>
101+
clean_names()
102+
103+
glimpse(age_gaps)
104+
105+
# Quickly check that the columns make sense.
106+
length(vctrs::vec_cast(age_gaps$release_year, integer())) == nrow(age_gaps)
107+
length(vctrs::vec_cast(age_gaps$age_difference, integer())) == nrow(age_gaps)
108+
unique(age_gaps$actor_1_gender)
109+
!any(is.na(as.Date(age_gaps$actor_1_birthdate)))
110+
length(vctrs::vec_cast(age_gaps$actor_1_age, integer())) == nrow(age_gaps)
111+
unique(age_gaps$actor_2_gender)
112+
!any(is.na(as.Date(age_gaps$actor_2_birthdate)))
113+
length(vctrs::vec_cast(age_gaps$actor_2_age, integer())) == nrow(age_gaps)
114+
115+
# Formally set the dates to dates.
116+
age_gaps <- age_gaps |>
117+
mutate(
118+
across(
119+
ends_with("birthdate"),
120+
as.Date
121+
)
122+
)
123+
124+
# Try to get a better understanding of the "gender" columns.
125+
count(age_gaps, actor_1_gender)
126+
count(age_gaps, actor_2_gender)
127+
128+
# The order of the characters doesn't seem to be consistent
129+
age_gaps |>
130+
summarize(
131+
p_1_older = mean(actor_1_age > actor_2_age),
132+
p_1_male = mean(actor_1_gender == "man"),
133+
p_1_female_2_male = mean(actor_1_gender == "woman" & actor_2_gender == "man"),
134+
p_1_first_alpha = mean(actor_1_name < actor_2_name)
135+
)
136+
137+
# For the most part, they put the man first if there's a man in the couple. It
138+
# doesn't look like there's a strict rule, though. But beware: Some movies have
139+
# more than 1 couple! Let's use all that to rebuild the data, always putting the
140+
# older character first.
141+
age_gaps <- age_gaps |>
142+
mutate(
143+
couple_number = row_number(),
144+
.by = "movie_name"
145+
) |>
146+
pivot_longer(
147+
cols = starts_with(c("actor_1_", "actor_2_")),
148+
names_to = c(NA, NA, ".value"),
149+
names_sep = "_"
150+
) |>
151+
# Put the older actor first.
152+
arrange(desc(age_difference), movie_name, birthdate) |>
153+
# While we have it pivoted, correct Elliot Page's name. I don't know if other
154+
# actors are similarly deadnamed, but at least we can fix this one. Note that
155+
# the *characters* played by Elliot in these particular films were women, so
156+
# I'll leave the gender as-is.
157+
mutate(
158+
name = case_match(
159+
name,
160+
"Ellen Page" ~ "Elliot Page",
161+
.default = name
162+
)
163+
) |>
164+
mutate(
165+
position = row_number(),
166+
.by = c("movie_name", "couple_number")
167+
) |>
168+
pivot_wider(
169+
names_from = "position",
170+
names_glue = "actor_{position}_{.value}",
171+
values_from = c("name", "gender", "birthdate", "age")
172+
)
173+
174+
# The gender isn't really the actor so much as it is the character. Let's
175+
# correct that.
176+
age_gaps <- age_gaps |>
177+
rename(
178+
"character_1_gender" = "actor_1_gender",
179+
"character_2_gender" = "actor_2_gender"
180+
)
181+
182+
glimpse(age_gaps)
183+
184+
# Save the data.
185+
write_csv(
186+
age_gaps,
187+
here::here(
188+
"data", "2023", "2023-02-14",
189+
"age_gaps.csv"
190+
)
191+
)
192+
```

data/2023/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ Archive of datasets and articles from the 2023 series of `#TidyTuesday` events.
1010
| 4 | `2023-01-24` | [Alone data](2023-01-24/readme.md) | [Alone data package](https://github.com/doehm/alone) | [Alone R package: Datasets from the survival TV series](https://gradientdescending.com/alone-r-package-datasets-from-the-survival-tv-series/) |
1111
| 5 | `2023-01-31` | [Pet Cats UK](2023-01-31/readme.md) | [Movebank for Animal Tracking Data](https://www.datarepository.movebank.org/handle/10255/move.882) | [Cats on the Move](https://themarkup.org/data-is-plural/2023/01/25/from-jazz-solos-to-cats-on-the-move#:~:text=Giuseppe%20Sollazzo%5D-,Cats%20on%20the%20move,-.%20Between%202013) |
1212
| 6 | `2023-02-07` | [Big Tech Stock Prices](2023-02-07/readme.md) | [Big Tech Stock Prices on Kaggle](https://www.kaggle.com/datasets/evangower/big-tech-stock-prices) | [5 Charts on Big Tech Stocks’ Collapse](https://www.morningstar.com/articles/1129535/5-charts-on-big-tech-stocks-collapse) |
13+
| 7 | `2023-02-14` | [Hollywood Age Gaps](2023-02-14/readme.md) | [Hollywood Age Gap Download Data](https://hollywoodagegap.com/movies.csv) | [Hollywood Age Gap](https://hollywoodagegap.com/) |

static/tt_data_type.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Week,Date,year,data_files,data_type,delim
2+
7,2023-02-14,2023,age_gaps.csv,csv,","
23
6,2023-02-07,2023,big_tech_stock_prices.csv,csv,","
34
6,2023-02-07,2023,big_tech_companies.csv,csv,","
45
5,2023-01-31,2023,cats_uk.csv,csv,","

0 commit comments

Comments
 (0)