Calculates age in years based on a reference date, which is the sytem date at default.
age(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...)
a logical to indicate whether age calculation should be exact, i.e. with decimals. It divides the number of days of year-to-date (YTD) of
a logical to indicate whether missing values should be removed
arguments passed on to
Ages below 0 will be returned as
NA with a warning. Ages above 120 will only give a warning.
This function vectorises over both
reference, meaning that either can have a length of 1 while the other argument has a larger length.
The lifecycle of this function is stable. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.
If the unlying code needs breaking changes, they will occur gradually. For example, a argument will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
On our website https://msberends.github.io/AMR/ you can find a comprehensive tutorial about how to conduct AMR data analysis, the complete documentation of all functions and an example analysis using WHONET data.
To split ages into groups, use the