modifyVector {HelpersMG}R Documentation

Modifies Elements of a Vector

Description

Modifies a vector by changing a subset of elements to match a second vector.

Usage

modifyVector(x, val, add = TRUE)

Arguments

x

A named vector.

val

A named vector with components to replace corresponding components in x.

add

If FALSE, only existing elements of x are returned.

Details

modifyVector modifies elements of a vector

Value

A modified version of x, with the elements of val replacing the elements of x

Author(s)

Marc Girondot

Examples

library("HelpersMG")
e <- c(M=10, L=20, J=30)
modifyVector(e, c(U=10, M=30))
modifyVector(e, c(U=10, M=30), add=FALSE)

[Package HelpersMG version 6.1 Index]