An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091120/769641c4/attachment-0001.pl>
Finding & replacing non-ASCII characters
3 messages · Steven Kang, Ista Zahn
It works the same for me as it does for non-ASCII characters:
x <- "mia. Sza?mita???"
x.out<-gsub("??","A",x)
x.out<-gsub("??","A",x.out)
x.out<-gsub("?","I",x)
x.out<-gsub("??","A",x.out)
x.out
[1]"mia.SzaImitaIA"
-Ista
On Thu, Nov 19, 2009 at 7:03 PM, Steven Kang <stochastickang at gmail.com> wrote:
Hi guys, Are there any feasible methods in searching & finding non-ASCII characters in R? For example, from the following object, x <- mia. Sza?mita??? The desired output is, x.out <- mia. SzaImitaIA Your help in resolving this would be greatly appreciated. ? ? ? ?[[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.
Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org
oops, get a little copy-paste happy there. Just need
x <- "mia. Sza?mita???"
x.out<-gsub("?","I",x)
x.out<-gsub("??","A",x.out)
x.out
-Ista
On Thu, Nov 19, 2009 at 7:51 PM, Ista Zahn <istazahn at gmail.com> wrote:
It works the same for me as it does for non-ASCII characters:
x <- "mia. Sza?mita???"
x.out<-gsub("??","A",x)
x.out<-gsub("??","A",x.out)
x.out<-gsub("?","I",x)
x.out<-gsub("??","A",x.out)
x.out
[1]"mia.SzaImitaIA"
-Ista
On Thu, Nov 19, 2009 at 7:03 PM, Steven Kang <stochastickang at gmail.com> wrote:
Hi guys, Are there any feasible methods in searching & finding non-ASCII characters in R? For example, from the following object, x <- mia. Sza?mita??? The desired output is, x.out <- mia. SzaImitaIA Your help in resolving this would be greatly appreciated. ? ? ? ?[[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.
-- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org
Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org