replace: Replace values in a vector or a matrix

Description Usage Arguments Value Examples

View source: R/replace.r

Description

Replace the values in x, specified by the vector of values values with the values in the vector replace.

Usage

1
2
3
4
5
6
7
replace(x, ...)

## Default S3 method:
replace(x, values, replace, ...)

## S3 method for class 'data.frame'
replace(x, values, replace, ...)

Arguments

x

an object

...

further arguments passed to or from other methods

values

a vector of values in 'x' to be replaced by values in replace

replace

replacement values

Value

an object with replaced values

Examples

1
2
3
4
5
vec = c("foo", "bar", "baz")
replace(vec, "bar", "spam")
replace(vec, c("foo", "bar"), c("bar", "foo"))
replace(vec, "spam", "eggs")
replace(vec, c("foo", "bar", "baz"), c("spam", "spam", "spam"))

bioDS/phyloRNA documentation built on Feb. 21, 2022, 3:28 p.m.