Learn R Programming

sdcMicro (version 5.6.1)

generateStrata: Generate one strata variable from multiple factors

Description

For strata defined by multiple variables (e.g. sex,age,country) one combined variable is generated.

Usage

generateStrata(df, stratavars, name)

Value

The original data set with one new column.

Arguments

df

a data.frame

stratavars

character vector with variable name

name

name of the newly generated variable

Author

Alexander Kowarik

Examples

Run this code

x <- testdata
x <- generateStrata(x,c("sex","urbrur"),"strataIDvar")
head(x)

Run the code above in your browser using DataLab