search for: substring2

Displaying 2 results from an estimated 2 matches for "substring2".

Did you mean: substring
2010 Mar 16
3
remove substring from each string vector component
Hi all, I have a string vector like that: x=c("1\t\t", "2", "3\t\t\t") I need to remove all the occurrences of "\t", in order to obtain: x = "1" "2" "3" I'm trying to use the function substring2, and it works for each component, for example: substring2(x[1], "\t") ="" gives x = "1" "2" " 3\t\t\t" I'd like to apply this function to each component and I tried the following: myfun = function(x, i) { substring2(x[i], "\t")...
2010 Feb 22
3
gsub patterns from vector elements w/out loop?
Dear list, I have two vectors: x <- c("one","two") y <- paste(rep(x,2),"blah") I want to replace all occurrences of each element of x in y with something else, so that y looks like this: y [1] "something else blah" "something else blah" "something else blah" [4] "something else blah" I can do this using a loop: for (