Skip to Content

replace {base}

Replace Values in a Vector
Package: 
base
Version: 
R 3.0.2

Description

replace replaces the values in x with indices given in list by those given in values. If necessary, the values in values are recycled.

Usage

replace(x, list, values)

Arguments

x
vector
list
an index vector
values
replacement values

Values

A vector with the values replaced.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Note

x is unchanged: remember to assign the result.

Documentation reproduced from R 3.0.2. License: GPL-2.