[R] regexpr with accents
Luca Meyer
lucam1968 at gmail.com
Mon Aug 6 15:16:48 CEST 2012
Thanks Arun,
It works all right, I just found out that my problem was not with accents but with the correct spelling of "some text".....
Kind regards,
Luca
Il giorno 06/ago/2012, alle ore 15.01, arun ha scritto:
>
>
> Hi,
>
> Here, the string with in the quotes are read exactly like that. So, you may have to use the symbol instead of "friendly" or "numeric" from the link. Or you have to convert those.
>
> d1 <- data.frame(V1 = 1:4,
> V2 = c("some text = 9", "some tèxt = 9", "some tèxt = 9", "some tèxt = 9"))
>
> d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9
> d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9
> d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9
>
> d1
> V1 V2
> 1 1 some text = 9
> 2 9 some tèxt = 9
> 3 9 some tèxt = 9
> 4 9 some tèxt = 9
>
> A.K.
>
>
> ----- Original Message -----
> From: Luca Meyer <lucam1968 a gmail.com>
> To: r-help a r-project.org
> Cc:
> Sent: Monday, August 6, 2012 8:25 AM
> Subject: [R] regexpr with accents
>
> Sorry but my previous email did not go through properly. Instead of the ? you should really read an è or è according to http://www.lookuptables.com/.
>
> So there are extended ASCII characters I need to deal with.
>
> I have tried
>
> d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9
> and
>
> d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9
>
> without success...
>
> Thanks,
> Luca
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help a 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