Learn R Programming

simPop (version 0.2.15)

specifyInput: create an object of class 'dataObj' required for further processing

Description

create an standardized input object of class 'dataObj' containing information on weights, household ids, household sizes, person ids and optionally strata. Outputs of this function are typically used in simStructure.

Usage

specifyInput(data, hhid, hhsize=NULL, pid=NULL, weight, strata=NULL)

Arguments

data
a data.frame or data.table featuring sample data.
hhid
character vector of length 1 specifying variable containing household ids within slot data.
hhsize
character vector of length 1 specifying variable containing household sizes within slot data. If NULL, household sizes are automatically calculated.
pid
character vector of length 1 specifying variable containing person ids within slot data. If NULL, person ids are automatically calculated.
weight
character vector of length 1 specifying variable holding sampling weights within slot data.
strata
character vector of length 1 specifing variable name within slot data of variable holding information on strata, e.g. regions or NULL if such variable does not exist.

Examples

Run this code
data(eusilcS)
inp <- specifyInput(data=eusilcS, hhid="db030", weight="rb050", strata="db040")
print(class(inp))
str(inp)

Run the code above in your browser using DataLab