[R] grep TRUE/FALSE

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed Jan 25 12:36:28 CET 2012


Yes, use grepl() rather than grep().

uwe Ligges


On 25.01.2012 12:28, Ana wrote:
> Is there a way to get a TRUE/FALSE condition as result, when using grep ?
>
> c="The file will be updated"
>
> if grep("updated",c)==1 then I get TRUE
>
> but
>
> How can I deal with grep("new",c) ? it gives integer(0)
>
>
> Thanks in advance.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list