Description Usage Arguments Details Value Author(s) See Also Examples
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.
1 | replaceVectorByEquality(vector, target, value)
|
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 |
A warning will be prompted if any item in the target cannot be found
A vector of the same length as the parameter vector
Jitao David Zhang
== for checking equality.
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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.