[R] FW: R encoding question
Xiaobo Gu
guxiaobo1982 at gmail.com
Mon Nov 29 14:18:16 CET 2010
But Sys.setlocale tries to change the option of the whole OS, I just want only R to use a specified encoding, how can I do this.
Xiaobo.Gu
>>-----Original Message-----
>>From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com]
>>Sent: Monday, November 29, 2010 8:57 PM
>>To: Xiaobo Gu
>>Subject: Re: FW: R encoding question
>>
>>I have never played with encodings myself. Suggest you read the postgresql
>>documentation and try different arguments to Sys.setlocale in R. You
>>probably have to do that before you initiate the database since it might not
>>have any effect afterwards. I am not sure this is the problem but its worth a try.
>>Here are some examples.
>>
>>Sys.setlocale(locale="C")
>>Sys.setlocale(locale="en_NZ.iso88591")
>>Sys.setlocale("LC_ALL", "en_US")
>>Sys.setlocale("LC_TIME", "English")
>>Sys.setlocale('LC_ALL','fr_FR')
>>Sys.putenv("LANGUAGE"="EN");Sys.setlocale("LC_ALL","EN")
>>Sys.putenv("LANGUAGE"="FR");Sys.setlocale("LC_ALL","FR")
>>
>>
>>2010/11/29 Xiaobo Gu <guxiaobo1982 at gmail.com>:
>>> Hi,
>>> Can you help with this.
>>>
>>> Regards,
>>>
>>> Xiaobo Gu
>>>
>>>
>>> -----Original Message-----
>>> From: Xiaobo Gu [mailto:guxiaobo1982 at gmail.com]
>>> Sent: Wednesday, November 24, 2010 10:19 PM
>>> To: r-help at r-project.org
>>> Subject: R encoding question
>>>
>>> Hi,
>>> I am using RpgSQL to retrieve data from a PostgreSQL database wich is
>>> with encoding UTF8, and I have some Chinese character in one of the
>>> columns, unfortunately R can't show it correctly.
>>>
>>>> df <- dbGetQuery(con, "select * from test") df
>>> a b
>>> 1 1 椤惧皬娉\xa2
>>> 2 2 瑕冩 EURO\xa1
>>>
>>> I see the following option, do I need to change the encoding option to
>>> show the corresponding texts? In my case how to set?
>>>
>>> $encoding
>>> [1] "native.enc"
>>>
>>> Thanks,
>>> Xiaobo Gu
>>>
>>>
>>
>>
>>
>>--
>>Statistics & Software Consulting
>>GKX Group, GKX Associates Inc.
>>tel: 1-877-GKX-GROUP
>>email: ggrothendieck at gmail.com
More information about the R-help
mailing list