[R] Extract some character from a character vector of length 1

ronggui ronggui.huang at gmail.com
Wed Nov 29 05:07:32 CET 2006


the content of th character vector (of length 1)  is as follows:

a <- "something2 ....pat1 name1 pat2 something2....pat1 name2
pat2....pat1 name3 pat2  "

I would like to extract the character bewteen pat1 and pat2. That's to
say, I would like to get a vecter of c("name1", "name2","name3").

What I did is use strsplit() twise. But I wonder if there any function
to this specific task?

Thanks.



More information about the R-help mailing list