[R] looking for a string

Charles C. Berry cberry at tajo.ucsd.edu
Tue Apr 15 02:27:57 CEST 2008


On Tue, 15 Apr 2008, [Ricardo Rodriguez] Your XEN ICT Team wrote:

> Hi all,
>
> I have not been able to find an answer to what is a simple question:
>
> conaguaMexicoSub <- subset(conagua, unidad == "Jalapa", select =
> c(equipo,X101:X309))
>
> This subset gives me all the rows from conagua where unidad is Jalapa.
> But, please, how do I get all the rows where unidad contents Jalapa?
>
> I've been looking at regex, but I didn't find how pass one to unidad ==.

You want

 	?regexpr

Something like

 	regexpr("Jalapa", as.character( unidad ) ) != -1

HTH,

Chuck
>
> Thanks!
>
> -- 
> Ricardo Rodríguez
> Your XEN ICT Team
>
> ______________________________________________
> 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list