Skip to contents

Returns the reverse-coded status for one or more variables in a survey design object or data frame.

Usage

extract_reverse_coded(x, ..., variable = NULL)

Arguments

x

A survey design object or data.frame.

...

<tidy-select> Variables to query. If empty, returns reverse-coded status for all columns of x. Cannot be combined with variable.

variable

character. Alternative programmatic interface: character vector of variable names. Cannot be combined with ....

Value

A named logical vector. Variables not marked as reverse-coded return FALSE. When all specified variables are missing, returns logical(0).

Examples

d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
               strata = sdmvstra, nest = TRUE)
d <- set_reverse_coded(d, bpxsy1)
extract_reverse_coded(d, bpxsy1)
#> bpxsy1 
#>   TRUE 
extract_reverse_coded(d)
#>     seqn  sdmvpsu sdmvstra wtmec2yr wtint2yr ridstatr riagendr ridageyr 
#>    FALSE    FALSE    FALSE    FALSE    FALSE    FALSE    FALSE    FALSE 
#> ridreth3 indfmpir dmdeduc2   bpxsy1   bpxdi1   bpxpls 
#>    FALSE    FALSE    FALSE     TRUE    FALSE    FALSE