2022-09-22 14:20:46 +02:00
|
|
|
% Generated by roxygen2: do not edit by hand
|
|
|
|
% Please edit documentation in R/age_calc.R
|
|
|
|
\name{age_calc}
|
|
|
|
\alias{age_calc}
|
2023-01-03 14:12:12 +01:00
|
|
|
\title{Calculate age in years, months, or days}
|
2022-09-22 14:20:46 +02:00
|
|
|
\usage{
|
|
|
|
age_calc(dob, enddate = Sys.Date(), units = "years", precise = TRUE)
|
|
|
|
}
|
|
|
|
\arguments{
|
2023-01-03 14:12:12 +01:00
|
|
|
\item{dob}{Date of birth}
|
2022-09-22 14:20:46 +02:00
|
|
|
|
2023-01-03 14:12:12 +01:00
|
|
|
\item{enddate}{End date for age calculation (default is Sys.Date())}
|
2022-09-22 14:20:46 +02:00
|
|
|
|
2023-01-03 14:12:12 +01:00
|
|
|
\item{units}{Units for age calculation (default is "years").
|
|
|
|
Can be c("days", "months", "years")}
|
2022-09-22 14:20:46 +02:00
|
|
|
|
2023-01-03 14:12:12 +01:00
|
|
|
\item{precise}{Option to calculate age precisely (default is TRUE)}
|
2022-09-22 14:20:46 +02:00
|
|
|
}
|
|
|
|
\value{
|
2023-01-04 14:33:48 +01:00
|
|
|
numeric vector length 1
|
2022-09-22 14:20:46 +02:00
|
|
|
}
|
|
|
|
\description{
|
2023-01-03 14:12:12 +01:00
|
|
|
Calculate age in years, months, or days
|
2022-09-22 14:20:46 +02:00
|
|
|
}
|
|
|
|
\examples{
|
2023-01-05 10:21:46 +01:00
|
|
|
trunc(age_calc(as.Date("1945-10-23"),as.Date("2018-09-30")))
|
2022-09-22 14:20:46 +02:00
|
|
|
}
|
2023-01-03 14:12:12 +01:00
|
|
|
\references{
|
2023-01-11 12:54:08 +01:00
|
|
|
Becker, J.P. (2020). eeptools: An R Package for Teaching and Learning Ecology
|
|
|
|
and Evolutionary Biology. Journal of Statistical Software, 93(2), 1-27.
|
|
|
|
doi: 10.18637/jss.v093.i02
|
2023-01-03 14:12:12 +01:00
|
|
|
}
|
|
|
|
\seealso{
|
|
|
|
\code{\link[lubridate]{time_length}}
|
|
|
|
}
|
2022-09-22 14:20:46 +02:00
|
|
|
\keyword{age}
|
2023-01-03 14:12:12 +01:00
|
|
|
\keyword{date}
|
|
|
|
\keyword{time}
|