This function creates a survey design object using the srvyr package. It takes a data frame and specified columns for IDs, strata, weights, and variables, and returns a survey design object.

mps_design(df = NULL, ids, strata, weight, vars)

Arguments

df

A data frame containing the survey data. Default is NULL.

ids

A column name in the data frame representing the cluster or primary sampling unit (PSU) IDs.

strata

A column name in the data frame representing the strata.

weight

A column name in the data frame representing the survey weights.

vars

A character vector of variable names to include in the survey design.

Value

A survey design object created using the srvyr package.

Examples

if (FALSE) { # \dontrun{
# Example usage:
survey_design <- mps_design(df = your_dataframe, ids = "psu_id", strata = "strata", weight = "weight", vars = c("var1", "var2", "var3"))
} # }