calculate_age_from_dob: Function to calculate age from date of birth

Description Usage Arguments Value Examples

View source: R/IPDFileCheck.R

Description

Function to calculate age from date of birth

Usage

1
2
3
4
5
6
7
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

1
2
3
4
5
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")

IPDFileCheck documentation built on Feb. 1, 2022, 9:07 a.m.