Displaying 1 result from an estimated 1 matches for "xx11xx12".
2009 Oct 05
1
gsub - replace multiple occurences with different strings
Hi,
I search a way to replace multiple occurrences of a string with
different strings
depending on the place where it occurs.
I tried the following;
x <- c("xx y e d xx e t f xx e f xx")
x <- gsub("xx", c("x1", "x2", "x3", "x4"), x)
what I want to get is;
x =
x1 y y e d x2 e t f x3 e f x4
but what I get is;
x =
x1 y y e