calculate_age_from_dob: Function to calculate age from date of birth

View source: R/IPDFilecheck.R

calculate_age_from_dobR Documentation

Function to calculate age from date of birth

Description

Function to calculate age from date of birth

Usage

calculate_age_from_dob(
  data,
  columnname,
  enddatecol = NULL,
  dateformat = "dmy",
  nrcode = NA
)

Arguments

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

Value

data if success error if failure

Examples

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")

sheejamk/ipdfilecheck documentation built on March 10, 2024, 11:23 p.m.