I have a data frame like this:
ID <- c("A", "B", "C", "D")
birthday <- c(12, 23, 2, 20)
birthmonth <- c(8, 10, 3, 9)
birthyear <- c(79, 62, 66, 83)
mydf <- data.frame(ID, birthday, birthmonth, birthyear)
mydf
ID birthday birthmonth birthyear
1 A 12 8 79
2 B 23 10 62
3 C 2 3 66
4 D 20 9 83
So, as you can see birth years are stated as 2 digits, and month, day, and year information are on different columns. In such a data frame, how can I calculate mean age for my sample?
Thank you so much!