HI I am getting below error when I am trying to load/ install any packages. This happened when installed new version of .
Error in nchar(homeDir) : invalid multibyte string, element 1
In addition: Warning message:
In normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:/Users/my.name/OneDrive - companies name/Documents": The system cannot find the path specified
R has problems with cloud-synced folders (OneDrive in your case) and non-ASCII characters in your package library path, I recommend you to set your package library in a non-synced folder.
You can change the default library folder by setting your R_LIBS_SITE environmental variable in 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.2\\library"
For a more detailed explanation, you can read this blog post
Error in nchar(homeDir) : invalid multibyte string, element 1
Warning message:
In normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:/Users/my.name/OneDrive -(companies name)l/Documents": The system cannot find the path specified
R is sensitive and you need to be careful with file and folder names. Don't add "space"/"-" or other special character to your folder or file names that you will use in R. So, change your library folder/ or name then try again.
In simple--
Incorrect way--- "C:/Users/my.name/OneDrive -(companies name)l/Documents" because here == "(companies name)", "-" are special character that creating problem in your case
correct way--- "C:/Users/my_name/OneDrive_companies name_l/Documents" or
"C:/Users/hhyhfh/Documents"