replace_values: Replace values in a vector with supplied values

View source: R/transforms_time.R

replace_valuesR Documentation

Replace values in a vector with supplied values

Description

Replace values in a vector with supplied values

Usage

replace_values(x, ..., .not_found = NULL)

Arguments

x

The vector in which to replace values

...

Name and value pairs, where name is what is replaced and value is what it is replaced with.

.not_found

Value to use for unmatched values. If not provided, unmatched values are unchanged.

Value

A vector with the replaced values. An attempt is made to convert the return type to numeric, if possible.

Examples

replace_values(c("a","b","c"),a=1,b=2)
replace_values(c("a","b","c"),a=1,b=2, .not_found = NA)
replace_values(c("a","b","c"),a=1,b=2, .not_found = "")
replace_values(c("a","b","c"),a=1,b="hello", .not_found = "")

qPharmetra/PMDatR documentation built on April 7, 2024, 5:42 p.m.