[R] grep

R. Heberto Ghezzo heberto at meakins.lan.mcgill.ca
Thu Jan 24 18:13:06 CET 2002


Hello, I have a problem with 'grep'
I read several lines from a file
 p <- readLines(pfile,n=8)
now I have to check that a key word "JABBERWOCKY" is not in that segment

a <- grep("JABBERWOCKY",p)
which gives a 1 if the key is in the text or 'numeric(0)
how can I test it
if(a==1) gives Ok in one case and error:missing value where logical
needed in the other.
How can I coerce 'a' to be 0 or 1?
thanks for any help.
.
H.Ghezzo
McGill University
Montreal - Canada

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list