[R] looking for a string

Charles C. Berry cberry at tajo.ucsd.edu
Wed Apr 16 05:15:09 CEST 2008


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

> Charles C. Berry wrote:
>>
>> You want
>>
>>     ?regexpr
>>
>> Something like
>>
>>     regexpr("Jalapa", as.character( unidad ) ) != -1
>>
>> HTH,
>>
>> Chuck
>
> Please, look at this...
>
> > substringJalapa <- regexpr("Jalapa", as.character(conagua$unidad ) )
> != -1
> Hubo 50 o  más avisos (use warnings() para ver los primeros 50)
> > warnings()
> Warning messages:
> 1: In regexpr("Jalapa", as.character(conagua$unidad)) ... :
>  string de entrada 1 es inválida en este locale
> 2: In regexpr("Jalapa", as.character(conagua$unidad)) ... :
>  string de entrada 2 es inválida en este locale
> 3: In regexpr("Jalapa", as.character(conagua$unidad)) ... :
>  string de entrada 3 es inválida en este locale
>
> The error means something like "Input string 1 is not valid for this
> locale". Sorry, I am not able yet to control messages language.
>
> I don't know how to pass regexpr(.........) to my problem...
>

Like this:

conaguaMexicoSub <- subset(conagua,
 	regexpr("Jalapa", as.character( unidad ) ) != -1
 		select = c(equipo,X101:X309))

But it looks like you have to sort out some issues concerning dueling 
locales first.

Chuck


  > conaguaMexicoSub <- subset(conagua, unidad == "Jalapa", select =
> c(equipo,X101:X309))
>
> Please, could you help me with this? Thanks!
>
> Best,
>
> Ricardo
>
>
> -- 
> 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