Skip to content

Instantly share code, notes, and snippets.

@aqd14
Created April 14, 2019 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aqd14/5e3fcd47c5fb5ee57a0a360d9a8cf486 to your computer and use it in GitHub Desktop.
Save aqd14/5e3fcd47c5fb5ee57a0a360d9a8cf486 to your computer and use it in GitHub Desktop.
Using `difftime` to calculate age
# 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