Leap Year Tidy Tuesday: 27-02-2024
Vikram Ranga
2024-03-02
The Context
This year is a leap year i.e. the month of Feb has 29 days unlike other years where the month only has 28 days. The reason is that every year has 365.25 days so to adjust extra 1/4 day, every fourth year there is an additional in the month of Feb. This week’s
library(pacman)
p_load(tidyverse, DT, ggalt)
The Data
Let’s analyse the datasets.
births <- read_csv("D:/R Script/Tidytuesday/26-02-2024/births.csv")
births |>
DT::datatable(caption = "Birth Dataset")
#check row #20 we have Morarji Desai.
deaths <- read_csv("D:/R Script/Tidytuesday/26-02-2024/deaths.csv")
deaths |>
DT::datatable(caption = "Death Dataset")
This is quite interesting list, however, might not be exhaustive. Both the lists are starting with Popes. It shows how important role they played during medieval ages. Now, let’s try to see which cohort got more people.
The Plot & Summaries
Let’s get summary first
births |>
group_by(year_birth) |>
count() |>
ggplot(aes(x = year_birth,
y = n))+
geom_col(fill = "#58F37EFF")+
geom_xspline(aes(x = year_birth,
y = n+3),
colour = '#FC4902FF',
spline_shape = -1,
size = 2)+
scale_x_continuous(breaks = seq(1400, 2010, 30))+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90),
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank())+
labs(x = "Birth Year",
y = "#",
title = "Number of famous people born on 29th Feb.",
caption = "Wikipedia data")
The graph shows that during 1970s-80s have more famous people born on 29th Feb. Moreover, the birth chart again coming down in the 2000s. Since, this is not exhaustive dataset, other pattern could have been missed.
There is data on deaths but I will just focus on births here. Let’s see how many years they lived.
births |>
mutate(yearsLived = year_death - year_birth) |>
filter(!is.na(yearsLived)) |> # remove the NAs
ggplot(aes(x = year_birth,
y = yearsLived))+
geom_hline(yintercept = seq(20, 100, 20),
colour = 'grey80')+
geom_xspline(spline_shape = -0.25,
colour = "#63991DFF")+
geom_point(size = 3,
colour = "white")+
geom_point(size = 1.5,
colour = "#F6871FFF")+
theme_bw() +
theme(panel.border = element_blank(),
panel.grid = element_blank(),
axis.ticks = element_blank(),
axis.text.x = element_text(angle = 30)) +
labs(y = "Age at Death",
x = "Birth Year",
title = "How long people, born on 29th Feb., lived")
There is hardly any pattern, except that life is getting shorter after ca. 1950s. It sad to see that some people died in their 20s! but still made impact on the world - kudos! However, people managed to reach to 90 in 18th century - that’s quite remarkable. To give you context: In 1947 (the year we got independence), the life expectancy of an average Indian was around 32 years.
I enjoyed analysing this data, hope you will find it worth spending your time!
Ciao!