Re: [R] About grep

2007-08-07 Thread Vladimir Eremeev
Shao wrote: Hi,everyone. I have a problem when using the grep. for example: a - c(aa,aba,abac) b- c(ab,aba) I want to match the whole word,so grep(^aba$,a) it returns 2 but when I used it a more useful way: grep(^b[2]$,a), it doesn't work at all, it can't find it, returning

Re: [R] About grep

2007-08-07 Thread Ted Harding
On 07-Aug-07 04:20:27, Shao wrote: Hi,everyone. I have a problem when using the grep. for example: a - c(aa,aba,abac) b- c(ab,aba) I want to match the whole word,so grep(^aba$,a) it returns 2 but when I used it a more useful way: grep(^b[2]$,a), it doesn't work at all, it can't

[R] About grep

2007-08-06 Thread Shao
Hi,everyone. I have a problem when using the grep. for example: a - c(aa,aba,abac) b- c(ab,aba) I want to match the whole word,so grep(^aba$,a) it returns 2 but when I used it a more useful way: grep(^b[2]$,a), it doesn't work at all, it can't find it, returning integer(0). How can I chang the

Re: [R] About grep

2007-08-06 Thread Stephen Tucker
try grep(paste(^,b[2],$,sep=),a) your version will match b2: grep(^b[2]$,c(b,b2,b3)) [1] 2 --- Shao [EMAIL PROTECTED] wrote: Hi,everyone. I have a problem when using the grep. for example: a - c(aa,aba,abac) b- c(ab,aba) I want to match the whole word,so grep(^aba$,a) it

Re: [R] About grep

2007-08-06 Thread Shao
Oh,great. Thanks. On 8/7/07, Stephen Tucker [EMAIL PROTECTED] wrote: try grep(paste(^,b[2],$,sep=),a) your version will match b2: grep(^b[2]$,c(b,b2,b3)) [1] 2 --- Shao [EMAIL PROTECTED] wrote: Hi,everyone. I have a problem when using the grep. for example: a -