ReverseCode: Reverse Coding Variables

Description Usage Arguments Details Source Examples

Description

I never actually know how to do them, so I google this every time. Perhaps its time to settle this once and for all.

Usage

1

Arguments

var

a numeric variable

Details

Thanks goes to James Martherus.

Source

https://github.com/jamesmartherus/martherus

Examples

1
2
3
4
5
x1 <- c(1, 2, 3, 4, NA, 5)
reverse_code(x1)   #c(5, 4, 3, 2, NA, 1)

x2 <- c(0, 1, 2, NA, 4, 7)
reverse_code(x2)    #c(7, 6, 5, NA, 3, 0)

lin-jennifer/lin documentation built on Jan. 1, 2021, 8:21 a.m.