Hello there. I'm having a error message that I can't understand.

When I try to install any package, or run any library, this error message is returning:

Error in nchar(homeDir) : invalid multibyte string, element 1

Can someone help me? I tried to find the solution in the internet, but I couldn't :frowning:

We need more information to help you, which operating system are you using? What R version you have installed? Do you have non-ASCII characters in your package library path or in your HOME directory? Can you show a complete console output of an specific example?

I'm using Windows 10.

My version of R is the lastest version.

I don't know what are "non-ASCII characters", but some packages that was usualy used, return this error.

I will show a example:

install.packages("nortest")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

RTools: Toolchains for building R and R packages from source on Windows
Installing package into ‘C:/Users/Usuário/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/nortest_1.0-4.zip'
Content type 'application/zip' length 38650 bytes (37 KB)
downloaded 37 KB

package ‘nortest’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\Usuário\AppData\Local\Temp\Rtmpk1GqbH\downloaded_packages
Error in nchar(homeDir) : invalid multibyte string, element 1

The last string, return the error. I have no ideia how to fix it.

This would be a non-ASCII character. In theory R 4.2 should support utf8 encoding now but I think you need to change some encoding configuration on Windows for that to work, I haven't tested this myself so I can't give any specifics, hopefully someone else that has already tried would help you.

Oh. So, it maybe will work if I change the name of my files?

The non-ASCII character is in your home directory path, you would need to change the name of your Windows user's HOME folder.

This topic was automatically closed 21 days after the last reply. 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.