selectHouseholdData | R Documentation |
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)
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 |
a data.frame with only household level variables and one record per household
It is of great importance that users select a variable with containing information on household-ids and weights in hhVars
.
Thijs Benschop and Bernhard Meindl
## ori-hid: household-ids; household_weights: sampling weights for households
x_hh <- selectHouseholdData(dat=testdata, hhId="ori_hid",
hhVars=c("urbrur", "roof", "walls", "water", "electcon", "household_weights"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.