[R] grep function with patterns list...

Stéphane CRUVEILLER scruveil at genoscope.cns.fr
Mon Oct 16 15:47:53 CEST 2006


Ooops sorry for html tags... Just forgot to edit the message
before sending it...
So back to my question:

Thx for the hint, but what would I have used if "b","c" and "d"
were values of a dataframe for instance?

X is for instance a dataframe:
 >X
     Mypatterns
1   pattern1
2   pattern2
3   pattern3

Y is another dataframe.

If I do:

grep(X$Mypatterns,Y) this will take into account only the first pattern...
I could use a loop but I vaguely remember an elegant trick that combined
grep and %in%.


Stéphane.



More information about the R-help mailing list