Learn R Programming

SUMMER (version 0.2.3)

getBirths: Function to get Births file from DHS .dta files.

Description

Function to get Births file from DHS .dta files.

Usage

getBirths(filepath = NULL, data = NULL, surveyyear,
  variables = c("caseid", "v001", "v002", "v004", "v005", "v021", "v022",
  "v023", "v024", "v025", "v139", "bidx"), strata = c("v024", "v025"),
  dob = "b3", alive = "b5", age = "b7", date.interview = "v008",
  month.cut = c(1, 12, 24, 36, 48, 60), year.cut = seq(1980, 2020, by =
  5))

Arguments

filepath

file path of raw .dta file from DHS. Only used when data frame is not provided in the function call.

data

data frame of a DHS survey

surveyyear

year of survey

variables

vector of variables to be used in obtaining the person-month files. The variables correspond the the DHS recode manual VI. For early DHS data, the variable names may need to be changed.

strata

vector of variable names used for strata. If a single variable is specified, then that variable will be used as strata indicator If multiple variables are specified, the interaction of these variables will be used as strata indicator.

dob

variable name for the date of birth.

alive

variable name for the indicator of whether child was alive or dead at the time of interview.

age

variable name for the age at death of the child in completed months.

date.interview

variable name for the date of interview.

month.cut

The cutoff of each bins of age group in the unit of months. Default values are 1, 12, 24, 36, 48, and 60, representing the age groups (0, 1), [1, 12), [12, 24), ..., [48, 60).

year.cut

The cutoff of each bins of time periods, including both boundaries. Default values are 1980, 1985, ..., 2020, representing the time periods 80-84, 85-89, ..., 15-19.

Value

This function returns a new data frame where each row indicate a person-month, with the additional variables specified in the function argument.

Examples

Run this code
# NOT RUN {
my_fp <- "/myExampleFilepath/surveyData.DTA"
DemoData <- getBirths(filepath = my_fp, surveyyear = 2015) 
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab