Hi, before I start: this is a cross posting of a related SO issue by someone else that also bugs me:
Of course I will update both issues in case of a solution.
So, whenever I launch R or RStudio (R 3.5.2 with latest RTools) on Windows 10, I am getting the warning:
During Startup - Warning message:
Setting LC_CTYPE = failed
There seem to be several solutions for Mac OS and also some for Ubuntu, but I haven't seen any on Windows. The warning is frustrating as it also appears during package installation, where it is converted into an error which is stopping the installation process.
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
When I was having problems with locales in R (I got bogged down in character encoding hell) I did not go in the .Renviron direction, but edited my .Rprofile file instead, and it worked - there may be multiple solutions to the issue.
My problem & solution is documented on Stack Overflow (this forum was very young back then...)
Thanks for posting this alternative. I agree that many ways are possible when trying to change the startup behavior. As no one came up with an alternative resolving the issue on system level, I just like to add a link to an RStudio blog post that explains the differences of alternative ways for changing the startup behavior and may guide future readers on which path to take. Understanding R‘s startup.