stRoke/man/age_calc.Rd

40 lines
940 B
Plaintext
Raw Normal View History

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}
2023-01-12 13:44:29 +01:00
\source{
\doi{10.18637/jss.v093.i02}
}
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{
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")))
2023-01-20 21:10:35 +01:00
2022-09-22 14:20:46 +02:00
}
2023-01-03 14:12:12 +01:00
\references{
2023-01-12 13:44:29 +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.
2023-01-03 14:12:12 +01:00
}
2022-09-22 14:20:46 +02:00
\keyword{age}
2023-01-03 14:12:12 +01:00
\keyword{date}
\keyword{time}