rename.values: Replace/rename values in a vector

Description Usage Arguments Value Examples

View source: R/rename.R

Description

This function replaces character values with new character values, which is useful when performing rename operations when values are held in character vectors.

Usage

1
rename.values(x, ..., defaultValue = x, warn_missing = TRUE)

Arguments

x

Vector of values to replace

...

Key/value pairs in the form oldvalue="newvalue"

defaultValue

A vector of values to use as the default should the value not be found in ...

warn_missing

Print a message if any old names are not actually present in x

Value

A vector with values replaced

Examples

1
2
3
4
x <- c("fish", "fish", "fish", "whistle")
rename.values(x, fish="newfish")
rename.values(x, whistle="newwhistle")
rename.values(x, fish="newfish", defaultValue="not a fish")

mudata documentation built on Nov. 17, 2017, 7:30 a.m.