[R] Problem with the grep function
astephen at efs.mq.edu.au
Thu Jul 8 09:41:04 CEST 2004
grep("^b$",nom) will match "b" only.
Department of Statistics
NSW 2109, Australia
>>> "aubert at inapg.fr" <aubert at inapg.fr> 07/08/04 05:20pm >>>
Let me present to you my problem :
I have a character vector x and I would like to obtain the indices of
this vector that yielded exactly a match.
For example, x=nom, pattern="b", I would to obtain 2 because "b" is on
First program :
nom <- c("a","b","ab")
Then I try the option extended =FALSE (instead of TRUE by default) and
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).
R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!
More information about the R-help