Find out how many days are there since you were born:
library(tidyverse)
## Warning: package 'ggplot2' was built under R version 4.4.3
## Warning: package 'tidyr' was built under R version 4.4.3
## Warning: package 'purrr' was built under R version 4.4.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.2
## ✔ purrr 1.2.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(nycflights13)
library(lubridate)
library(lubridate)
my_birthday <- ymd("2006-04-16")
days_since_birth <- today() - my_birthday
print(days_since_birth)
## Time difference of 7331 days
Find out how many seconds (approximately) are there since you
were born:
time_interval <- my_birthday %--% now()
seconds_since_birth <- as.duration(time_interval)
print(seconds_since_birth)
## [1] "633478808.213267s (~20.07 years)"