[R] Writing Persian (Arabic) in a data frame

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Tue Jul 28 14:32:03 CEST 2020


On Tue, 28 Jul 2020 10:31:07 +0430
Vahid Borji <vahid.borji65 using gmail.com> wrote:

> A<-data.frame(x=c("مریم","ماریا"),y=c(1,1))

> The output is like this:
> 
>                          x                 y1
> <U+0645><U+0631><U+06CC><U+0645> 12
> <U+0645><U+0627><U+0631><U+06CC><U+0627> 1

This is one of those problems heavily affected by your version of R
(does it have stringsAsFactors = TRUE or FALSE by default?), your
operating system and locale (see [*] for a description of
Unicode-related problems in R on Windows).

Here is a similar problem from 9 years ago where Unicode characters
were displayed as escapes on Windows with US English (ANSI-1251)
locale when data.frame() converted strings to factors:
https://r.789695.n4.nabble.com/gsub-with-unicode-and-escape-character-td3672737.html

-- 
Best regards,
Ivan

P.S.

> 	[[alternative HTML version deleted]]

Please post in plain text, not HTML.

[*]
https://developer.r-project.org/Blog/public/2020/05/02/utf-8-support-on-windows/index.html



More information about the R-help mailing list