reverse_labelled_values: Reverse labelled values

View source: R/data_wrangling.R

reverse_labelled_valuesR Documentation

Reverse labelled values

Description

Taken from codebook package reverse the underlying values for a numeric haven::labelled() vector while keeping the labels correct

Usage

reverse_labelled_values(x)

Arguments

x

a labelled vector

Value

return the labelled vector with the underlying values having been reversed

Examples

x <- haven::labelled(rep(1:3, each = 3), c(Bad = 1, Good = 5))
x
reverse_labelled_values(x)

rubenarslan/formr documentation built on Feb. 6, 2024, 1:18 a.m.