Learn R Programming

codebook (version 0.9.6)

reverse_labelled_values: Reverse labelled values reverse the underlying values for a numeric haven::labelled() vector while keeping the labels correct

Description

Reverse labelled values reverse the underlying values for a numeric haven::labelled() vector while keeping the labels correct

Reverse labelled values reverse the underlying values for a numeric haven::labelled() vector while keeping the labels correct

Usage

reverse_labelled_values(x)

reverse_labelled_values(x)

Value

return the labelled vector with the underlying values having been reversed

return the labelled vector with the underlying values having been reversed

Arguments

x

a labelled vector

Examples

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

Run the code above in your browser using DataLab