calculate_age_from_dob | R Documentation |
Function to calculate age from date of birth
calculate_age_from_dob(
data,
columnname,
enddatecol = NULL,
dateformat = "dmy",
nrcode = NA
)
data |
a data frame |
columnname |
name of column corresponding to date of birth |
enddatecol |
column contaiining when to calculate the age to, default value is null, this means the age is calculated to the current date |
dateformat |
format of date e.g. dmy default is dmy |
nrcode |
non response code corresponding to date of birth |
data if success error if failure
library(IPDFileCheck)
this.df <- data.frame(c("1987-05-28", "1987-06-18"), c(1, 2),
stringsAsFactors = FALSE)
colnames(this.df) <- c("dob", "num")
calculate_age_from_dob(this.df, "dob", NULL, "ymd")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.