re_code {psyntur}R Documentation

Recode specified values by new values

Description

Recode specified values by new values

Usage

re_code(x, from, to)

Arguments

x

A vector, including column of data frame

from

The set of old values to be replaced by new ones

to

The set of new values to replace the old ones

Value

A vector that is the input vector but with old values replaced by new ones.

Examples

# Replace any occurrence of 1 and 2 with 101 and 201, respectively
x <- c(1, 2, 3, 4, 5, 1, 2)
re_code(x, from = c(1, 2), to = c(101, 201))

[Package psyntur version 0.1.0 Index]