21

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.

lokheart
  • 23,743
  • 39
  • 98
  • 169

3 Answers3

24

For Windows:

Sys.setlocale("LC_TIME", "English")
joran
  • 169,992
  • 32
  • 429
  • 468
aatrujillob
  • 4,738
  • 3
  • 19
  • 32
15
Sys.setlocale("LC_TIME", "C")

seems safer, works when "English" yields the "cannot be honored" warning.

miguev
  • 4,481
  • 21
  • 41
4

Windows? If so the R Installation and Administration Manual says to look here for information about valid locale settings:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_language_and_country_strings.asp

It might help for you to say what your goals really are. Changing dates may not require changing your locale.

IRTFM
  • 258,963
  • 21
  • 364
  • 487