Re: [R] grep negation

From: Don MacQueen <macq_at_llnl.gov>
Date: Fri 24 Jun 2005 - 01:15:12 EST

If all you need to do is extract the subset of elements of txt that do not contain 'foo', then

   txt[-i]

will do the job. Provided that at east one element of txt contains 'foo', that is.

-Don

At 2:59 PM +0200 6/23/05, Marcus Leinweber wrote:
>hi,
>
>using the example in the grep help:
>txt <- c("arm","foot","lefroo", "bafoobar")
>i <- grep("foo",txt); i
>[1] 2 4
>
>but how can i get the negation (1,3) when looking for 'foo'?
>
>thanks,
>m.
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Jun 24 01:23:51 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:59 EST