Skip to content

regexpr with accents

3 messages · arun, Luca Meyer

#
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&egravext = 9", "some t?xt = 9", "some t&#232xt = 9"))

d1$V1[regexpr("some t&egravext = 9",d1$V2)>0] <- 9
?d1$V1[regexpr("some t&#232xt = 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&egravext = 9
3? 9?????? some t?xt = 9
4? 9?? some t&#232xt = 9

A.K.


----- Original Message -----
From: Luca Meyer <lucam1968 at gmail.com>
To: r-help at 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 &egrave or &#232 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&egravext = 9",d1$V2)>0] <- 9
and 

d1$V1[regexpr("some t&#232xt = 9",d1$V2)>0] <- 9

without success...

Thanks,
Luca




??? [[alternative HTML version deleted]]

______________________________________________
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.
#
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: