Created
April 14, 2019 15:16
-
-
Save aqd14/5e3fcd47c5fb5ee57a0a360d9a8cf486 to your computer and use it in GitHub Desktop.
Using `difftime` to calculate age
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
# Notes | |
grand_slam_ages <- player_dob %>% | |
select(name, date_of_birth) %>% | |
inner_join(grand_slams, by = "name") %>% | |
mutate(age = as.numeric(difftime(tournament_date, date_of_birth, unit = "days") / 365.25)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment