powered by
Modifies a vector by changing a subset of elements to match a second vector.
modifyVector(x, val, add = TRUE)
A named vector.
A named vector with components to replace corresponding components in x.
If FALSE, only existing elements of x are returned.
A modified version of x, with the elements of val replacing the elements of x
modifyVector modifies elements of a vector
# NOT RUN { 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) # }
Run the code above in your browser using DataLab