I like to know what is the midpoint of 12 months and 5years 6months ? in years.
This is how i calculate this value.
Step1 : Converting 5years 6 months to days : 5 * 365.25 + 6 * 30 = 2007 days
Step2 : Converting 12 months to days : 365.25 days
Step3 : Subtracting 12 months in days (Step2) from Step1. : 2007days - 365.25days = 1642days
Step4 : 1642/2 = 821 day.
Step5 : 2007 - 821 = 1186 = 3.24 years
Like to confirm if this correct ?
To answer this particular question, you can use the duration class of lubridate:
library(lubridate)
mean(c(duration(1, units = "years"), duration(5.5, units = "years"))) |> as.duration()
# [1] "102562200s (~3.25 years)"