Re: [R] Vector of string

2009-06-23 Thread Sandor Benczik
njhuang86 wrote: > > Hi all. Suppose I have a vector of strings ie: ["12384", "AVC_TYU123123", > "ESPN_TYU", "TYU_TYU", "AVC3939", "hhr1919", "TYU0029"] > > Is there an efficient method that would allow me to return a vector of the > position of strings that start with "TYU"? So essentially,

Re: [R] Vector of string

2009-06-23 Thread Henrique Dallazuanna
Try this: s <- c("12384", "TYU123123","AVC3939", "hhr1919", "TYU0029") grep("^TYU", s) On Tue, Jun 23, 2009 at 11:51 AM, njhuang86 wrote: > > Hi all. Suppose I have a vector of strings ie: ["12384", "TYU123123", > "AVC3939", "hhr1919", "TYU0029"] > > Is there an efficient method that would allo

[R] Vector of string

2009-06-23 Thread njhuang86
Hi all. Suppose I have a vector of strings ie: ["12384", "TYU123123", "AVC3939", "hhr1919", "TYU0029"] Is there an efficient method that would allow me to return a vector of the position of strings that start with "TYU"? So essentially, I would like to get back in return [2, 5]. Anyways, any help