Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change time locale for R

Tags:

Here is my sessionInfo()

R version 2.14.0 (2011-10-31)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Chinese (Traditional)_Hong Kong S.A.R..950 
[2] LC_CTYPE=Chinese (Traditional)_Hong Kong S.A.R..950   
[3] LC_MONETARY=Chinese (Traditional)_Hong Kong S.A.R..950
[4] LC_NUMERIC=C                                          
[5] LC_TIME=Chinese (Traditional)_Hong Kong S.A.R..950    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_2.14.0

I try to use Sys.setlocale("LC_TIME", "en_US.UTF-8") to convert the output in date, but it gives me this error:

> Sys.setlocale("LC_TIME", "en_US.UTF-8")
[1] ""
Warning message:
In Sys.setlocale("LC_TIME", "en_US.UTF-8") :
  OS reports request to set locale to "en_US.UTF-8" cannot be honored

I wonder why and what can I do? Thanks.

like image 830
lokheart Avatar asked Nov 16 '11 02:11

lokheart


People also ask

What does locale mean in R?

A locale is a description of the local environment of the user, including the preferred language, the encoding of characters, the currency used and its conventions, and so on. Aspects of the locale are accessed by the R functions Sys. getlocale and Sys. localeconv . The system of naming locales is OS-specific.


1 Answers

For Windows:

Sys.setlocale("LC_TIME", "English")
like image 91
aatrujillob Avatar answered Nov 05 '22 16:11

aatrujillob