[R] length(grep(...

Romain Francois romain.francois at dbmail.com
Tue May 19 20:49:48 CEST 2009


Hi,

R>=2.9.0 ships grepl, which lets you do that:

any( grepl( TEXT, OBJECT) )

You can also:

install.packages( "operators" )
require( operators )
OBJECT %~+% TEXT

Romain

Dennis Fisher wrote:
> Colleagues
>
> R2.8.1 in OSX
>
> I often combine two commands as follows:
>     length(grep(TEXT, OBJECT)) > 0
> to see if a particular snippet of text exists within an object.
>
> Is there a single command that would accomplish this?
>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-415-564-2220
> www.PLessThan.com
>

-- 
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr




More information about the R-help mailing list