Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

set_survey_vars

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

'dplyr'-Like Syntax for Summary Statistics of Survey Data

v1.0.1
GPL-2 | GPL-3
Authors
Greg Freedman Ellis [aut, cre], Thomas Lumley [ctb], Tomasz Żółtak [ctb], Ben Schneider [aut, ctb], Pavel N. Krivitsky [ctb]
Initial release
2021-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.