Creates a household level file from a dataset with a household structure.
Creates a household level file from a dataset with a household structure.
It removes individual level variables and selects one record per household based on a household ID. The function can also be used for other hierachical structures.
selectHouseholdData(dat, hhId, hhVars)
Arguments
dat: a data.frame with the full dataset
hhId: name of the variable with the household (cluster) ID
hhVars: character vector with names of all household level variables
Returns
a data.frame with only household level variables and one record per household
Note
It is of great importance that users select a variable with containing information on household-ids and weights in hhVars.