[R] How to substitute special characters within a data frame?

Henrique Dallazuanna wwwhsd at gmail.com
Fri Aug 15 13:20:04 CEST 2008


Try this:

gsub("\\\\345", "a", "H\\345rkan")

But see:

cat("H\345rkan\n")

On Fri, Aug 15, 2008 at 6:54 AM, Yingfu Xie <Yingfu.Xie at sekon.slu.se> wrote:
> Hello all,
>
> I have a data frame in R, imported from an excel file in Swedish. The original file contains several columns that have special characters, such as \¨{a}, \¨{o}, and so on. After import such special characters are represented in the data frame by "\\345", "\\366" etc (don't ask me why). For example, a word "Hårkan" becomes ''H\\345rkan".
>
> Now my question is if it is possible to substitute those "H\\345rkan" by "Haarkan" or simply "Harkan" in R, ideally by finding those "\\345" and then replacing.
>
> Thanks in advance,
> Yingfu
>
>        [[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.
>
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list