Learn R Programming

enhancer (version 1.1.0)

replaceValues: Replace the values of a vector

Description

Simple function to map a vector of values to another.

Usage

replaceValues(Source, Search, Replace)

Value

$res

new values from a second vector.

Arguments

Source

A source of values to change.

Search

The values to search.

Replace

The equivalent values to replace.

Details

Simple function to map a vector of values another.

References

Covarrubias-Pazaran G (2016) Genome assisted prediction of quantitative traits using the R package sommer. PLoS ONE 11(6): doi:10.1371/journal.pone.0156744

Examples

Run this code


x <- letters[1:5]
y <- 1:5
z <- rep(letters[1:5],3)

replaceValues(Source=z, Search=x, Replace=y)


Run the code above in your browser using DataLab