Spencer Graves
2014-Nov-30 10:14 UTC
[R] Comparing Latin characters with and without accents?
Hello: How can one convert Latin characters with to the corresponding characters without? For example, I want to convert "?" to "u", similar to how tolower('U') returns "u". This can be done using chartr{base}, e.g., chartr('?', 'u', 'Ra?l') returns "Raul". However, I wondered if a simpler version of this is available. Thanks, Spencer p.s. findFn('convert to ascii') found 117 help pages in 70 packages. A brief review identified two to "Convert to ASCII": ASCIIfy {gtools} and stri_enc_toascii {stringi}. Neither of these did what I expected.
Milan Bouchet-Valat
2014-Nov-30 10:25 UTC
[R] Comparing Latin characters with and without accents?
Le dimanche 30 novembre 2014 ? 02:14 -0800, Spencer Graves a ?crit :> Hello: > > > How can one convert Latin characters with to the corresponding > characters without? For example, I want to convert "?" to "u", similar > to how tolower('U') returns "u". > > > This can be done using chartr{base}, e.g., chartr('?', 'u', > 'Ra?l') returns "Raul". However, I wondered if a simpler version of > this is available.This appears to work:> iconv("?", "", "ASCII//TRANSLIT")[1] "u" Regards> > Thanks, > Spencer > > > p.s. findFn('convert to ascii') found 117 help pages in 70 packages. > A brief review identified two to "Convert to ASCII": ASCIIfy {gtools} > and stri_enc_toascii {stringi}. Neither of these did what I expected. > > ______________________________________________ > R-help at r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Spencer Graves
2014-Nov-30 10:32 UTC
[R] Comparing Latin characters with and without accents?
Wonderful. Thanks very much. Spencer On 11/30/2014 2:25 AM, Milan Bouchet-Valat wrote:> Le dimanche 30 novembre 2014 ? 02:14 -0800, Spencer Graves a ?crit : >> Hello: >> >> >> How can one convert Latin characters with to the corresponding >> characters without? For example, I want to convert "?" to "u", similar >> to how tolower('U') returns "u". >> >> >> This can be done using chartr{base}, e.g., chartr('?', 'u', >> 'Ra?l') returns "Raul". However, I wondered if a simpler version of >> this is available. > This appears to work: >> iconv("?", "", "ASCII//TRANSLIT") > [1] "u" > > > Regards > >> Thanks, >> Spencer >> >> >> p.s. findFn('convert to ascii') found 117 help pages in 70 packages. >> A brief review identified two to "Convert to ASCII": ASCIIfy {gtools} >> and stri_enc_toascii {stringi}. Neither of these did what I expected. >> >> ______________________________________________ >> R-help at r-project.org mailing list >> stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code.