[R] Finding & replacing non-ASCII characters

Ista Zahn istazahn at gmail.com
Fri Nov 20 01:52:47 CET 2009


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




More information about the R-help mailing list