Description Usage Arguments Value Examples
View source: R/correct_attributes.R View source: R/reverse_labelled_values.R
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
1 2 3 |
x |
a labelled vector |
return the labelled vector with the underlying values having been reversed
return the labelled vector with the underlying values having been reversed
1 2 3 4 5 6 | 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)
|
<labelled<integer>[9]>
[1] 1 1 1 2 2 2 3 3 3
Labels:
value label
1 Bad
5 Good
<labelled<integer>[9]>
[1] 5 5 5 4 4 4 3 3 3
Labels:
value label
5 Bad
1 Good
<labelled<integer>[9]>
[1] 1 1 1 2 2 2 3 3 3
Labels:
value label
1 Bad
5 Good
<labelled<integer>[9]>
[1] 5 5 5 4 4 4 3 3 3
Labels:
value label
5 Bad
1 Good
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.