[R] Substituting elements in vector
Knut Hansen
knut.hansen at uit.no
Tue Feb 17 12:58:53 CET 2015
Dear list,
I have a vector:
my.vector <- c("A", "B", "C", "D", "E", "F", "G")
and two other:
vec1 <- c("p", "q", "r", "s", "t")
vec2 <- c("x", "y", "z")
I want to substitute elements "b" and "e" in my.vector with vectors vec1 and
vec2 respectively so that the result becomes the vector:
c("A", "p", "q", "r" , "s" , "t", "C" , "D", "x", "y", "z", "F", "G")
The ordering of the elements is important.
Knut Hansen
More information about the R-help
mailing list