Search code examples
rmacoslocale

R language setting can't be change with "default writes" command on mac


I'm a mac user and want to change R locale to English.

I know defaults write should set R's locale on osx. But, strangely, the command doesn't work.

defaults write org.R-project.R force.LANG en_US.UTF-8

When I launch R by executing R.app, English messages are properly shown, but Terminal.app shows Japanese messages:

R.app Terminal.app

My Environment is as follows:

  • Mac OS 10.8.5
  • R version 3.0.1 (2013-05-16) -- "Good Sport" Platform: x86_64-apple-darwin10.8.0 (64-bit)

Result of sessionInfo() on Terminal:

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] ja_JP.UTF-8/ja_JP.UTF-8/ja_JP.UTF-8/C/ja_JP.UTF-8/ja_JP.UTF-8

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

On R.app:

R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
[1] caret_5.17-7    grid_3.0.1      kernlab_0.9-18  lattice_0.20-15

Solution

  • As @plannapus wrote, starting R with Language=en R works well in my environment. See here.

    Thank you for your help.


    edit (2013/11/8)

    According to gentle community replies, there seems to be several solutions. As for me, both of these ways works well.

    1. Launching R console with specifying language as Language=en R (already mentioned previous post)
    2. Set environment variable by adding just one line Language=en R to ~/.Renviron