recode: Recode values

View source: R/recode.R

recodeR Documentation

Recode values

Description

superseded

recode() has been superseded by case_match().

Replace old values of a vector with new values.

Usage

recode(.x, ..., .default = NULL, .missing = NULL)

Arguments

.x

A vector

...

A series of old = new pairs specifying the new values

.default

The default value if all conditions evaluate to FALSE

.missing

What missing values should be replaced with

Examples

char_vec <- c("a", "b", "c")
recode(char_vec, a = "Apple", b = "Banana")

num_vec <- 1:3
recode(num_vec, `1` = 10, `2` = 25, .default = 100)

tidytable documentation built on Sept. 11, 2024, 8:05 p.m.