[R] regexpr with accents
arun
smartpink111 at yahoo.com
Mon Aug 6 15:01:17 CEST 2012
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 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 è 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 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.
More information about the R-help
mailing list