[R] Problem with the grep function

Wolski wolski at molgen.mpg.de
Thu Jul 8 09:49:00 CEST 2004

Or you must mark the word beginning with ^ and the end $ if you like to use grep.



*********** REPLY SEPARATOR  ***********

On 7/8/2004 at 9:20 AM aubert at inapg.fr wrote:

>>>Let me present to you my problem :
>>>I have a character vector x and I would like to  obtain the indices of
>>>elements of
>>>this vector that yielded exactly a match.
>>>For example,  x=nom, pattern="b", I would to obtain 2 because "b" is on
>>>second position.
>>>First program :
>>>nom <- c("a","b","ab")
>>>2 3
>>>Then I try the option extended =FALSE (instead of TRUE by default) and I 
>>>obtain '2 3' a second time.
>>>Please can you help me : How can I obtain only 2 in using the grep
>>>(without using the match function).
>>>Thanks you
>>>Julie AUBERT
>>>R-help at stat.math.ethz.ch mailing list
>>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Dipl. bio-chem. Eryk Witold Wolski    @    MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin       'v'    
tel: 0049-30-83875219               /   \    
mail: wolski at molgen.mpg.de        ---W-W----    http://www.molgen.mpg.de/~wolski

More information about the R-help mailing list