8

I have the following warning message after upgrading windows 10 whenever I launch Rstudio.

During startup - Warning message: Setting LC_CTYPE= failed

I'm running currently Microsoft R Open version.

Is there a way I could fix this warning message, I found some solutions for Mac at stackoverflow but not for Windows.

4
  • 2
    What does Sys.getlocale() return?
    – alistaire
    Jan 9, 2019 at 5:08
  • 1
    Sys.getlocale() returns "C"
    – moth
    Jan 9, 2019 at 6:14
  • 1
    I believe that's the default when it's not set. I'm not sure what the best way to set it in Windows is, but I'm pretty sure setting LC_ALL to something like en_US.UTF-8 like Unix-alikes do won't work; you'll need to figure out what locales are available. Also note that Sys.setlocale will only set it for the R session, so you'll need to set it more globally in your OS somewhere.
    – alistaire
    Jan 10, 2019 at 1:23
  • I cross posted this under RStudio Community and will update here in case of a solution over there -> community.rstudio.com/t/…
    – Taz
    Jan 12, 2019 at 12:55

1 Answer 1

5

The best workaround I found for that issue is to set up a .Renviron file and overwrite the locales there.

How to set and modify the .Renviron file is described i.e. in the regarding chaper of the open book Efficient R Programming. Therefore, one needs just to copy the lines

user_renviron = path.expand(file.path("~", ".Renviron"))
file.edit(user_renviron) # open with another text editor if this fails

and afterwards edit the .Renviron file to change the locale. Note that regarding on the OS some locales won't exist and it might be non trivial to install them. However, the locale "C" should always exist. For me also "English_United States.1252" worked on Windows and I added the following lines (including a linebreak) to the .Renviron file

LC_COLLATE  = "English_United States.1252"
LC_CTYPE    = "English_United States.1252"
LC_MONETARY = "English_United States.1252"
LC_NUMERIC  = "English_United States.1252"
LC_TIME     = "English_United States.1252"

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.