replaceVectorByEquality: REPLACE ITEMS OF VECTOR BY EQUALITY

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/AllFunctions.R

Description

The function replces (or updates) the items of a given vector by checking the equality with the target parameter. If found, the item will be replaced by the value parameter. The length of both target and value must be the same and could be longer than 1, in which case the replace will be iterated.

Usage

1

Arguments

vector

A vector to be replaced. The items of the vector must be atom types, since the equality is checked by '=='.

target

targets to be replaced, could be either single or a vector

value

values to be replaced at the positions of targets, must be of the same length of target

Details

A warning will be prompted if any item in the target cannot be found

Value

A vector of the same length as the parameter vector

Author(s)

Jitao David Zhang

See Also

== for checking equality.

Examples

1
2
3
vector <- c("java", "perl", "python", "c#")
replaceVectorByEquality(vector, target="c#", value="c/c++")
replaceVectorByEquality(vector, target=c("c#","perl"), value=c("c/c++","R"))

ddCt documentation built on Nov. 8, 2020, 4:57 p.m.