[R] grep negation

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Thu Jun 23 15:25:20 CEST 2005


try this:

seq(along = txt)[-i]


Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Marcus Leinweber" <leinwebe at eva.mpg.de>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, June 23, 2005 2:59 PM
Subject: [R] grep negation


> 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 at 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
>




More information about the R-help mailing list