每次安装packages都会出现下面的错误:

Error in install.packages : unable to translate 'C:\Users<U+5C0F><U+65CB><U+98CE>\Documents\R\win-library\4.1' to native encoding

R has problems with the non-ASCII characters in your package library path, I recommend you to set your package library in a different location.

You can change the default library folder by setting your R_LIBS_SITE environmental variable on a .Reviron or .Rprofile file. For example:

# In a .Renviron file you can set it by adding a line like this one with the desired location 
R_LIBS_SITE="C:\\Program Files\\R\\R-4.1.1\\library"

For a more detailed explanation, you can read this blog post

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.