set_survey_vars: Set the variables for the current survey variable

View source: R/survey_statistics_helpers.R

set_survey_varsR Documentation

Set the variables for the current survey variable

Description

This is a helper to allow srvyr's syntactic style. In general, users will not have to worry about setting variables in a survey object unless they are trying to extend srvyr. This function helps convert a vector to a variable in the correct part of a survey object's structure so that functions can refer to it using the survey package's formula notation. See vignette("extending-srvyr") for more details.

Usage

set_survey_vars(.svy, x, name = "__SRVYR_TEMP_VAR__", add = FALSE)

Arguments

.svy

A survey object

x

A vector to be included in the variables portion of the survey object

name

The name of the variable once it is added. Defaults to '__SRVYR_TEMP_VAR__' which is formatted weirdly to avoid name collisions.

add

FALSE, the default, overwrite all current variables. If TRUE, will add this variable instead.

Value

a tbl_svy with the variables modified


srvyr documentation built on Sept. 11, 2024, 8:43 p.m.