mirror of
https://github.com/agdamsbo/stRoke.git
synced 2024-11-22 04:50:23 +01:00
new documention with gpttools
This commit is contained in:
parent
6098335cea
commit
2f221f216a
22
R/age_calc.R
22
R/age_calc.R
@ -1,20 +1,24 @@
|
|||||||
#' Calculating age from date of birth
|
#' Calculate age in years, months, or days
|
||||||
#'
|
#'
|
||||||
#' For age calculations. Vectorised.
|
#' @param dob Date of birth
|
||||||
#' @param dob Date of birth. Data format follows standard POSIX layout. Format is yyyy-mm-dd.
|
#' @param enddate End date for age calculation (default is Sys.Date())
|
||||||
#' @param enddate Date to calculate age at. Format is yyyy-mm-dd.
|
#' @param units Units for age calculation (default is "years").
|
||||||
#' @param units Default is "years". Can be changed to "days".
|
#' Can be c("days", "months", "years")
|
||||||
#' @param precise Default is TRUE. Flag set whether to include calculations of spring years. Only of matter if using units = "days".
|
#' @param precise Option to calculate age precisely (default is TRUE)
|
||||||
#' @keywords age
|
#' @return Age
|
||||||
#'
|
|
||||||
#' @return Vector of age
|
|
||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
|
#' age_calc(dob = as.Date("1995-04-25"), enddate = as.Date("2020-04-25"), units = "years")
|
||||||
#' # Kim Larsen (cpr is known from album)
|
#' # Kim Larsen (cpr is known from album)
|
||||||
#' dob<-as.Date("1945-10-23")
|
#' dob<-as.Date("1945-10-23")
|
||||||
#' date<-as.Date("2018-09-30")
|
#' date<-as.Date("2018-09-30")
|
||||||
#' trunc(age_calc(dob,date))
|
#' trunc(age_calc(dob,date))
|
||||||
|
#' @references
|
||||||
|
#' 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
|
||||||
|
#'
|
||||||
|
#' @seealso \code{\link[lubridate]{time_length}}
|
||||||
|
#' @keywords date time age
|
||||||
|
|
||||||
age_calc<-function (dob, enddate = Sys.Date(), units = "years", precise = TRUE)
|
age_calc<-function (dob, enddate = Sys.Date(), units = "years", precise = TRUE)
|
||||||
## Build upon the work of Jason P. Becker, as part of the eeptools
|
## Build upon the work of Jason P. Becker, as part of the eeptools
|
||||||
|
Loading…
Reference in New Issue
Block a user