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

Hi! I am a new user of R, and I have been having the same problem while installing packages.

I am trying to install the following package:

install.packages("devtools")

Then have this Error:

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

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/roman/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/devtools_2.4.3.zip'
Content type 'application/zip' length 422901 bytes (412 KB)
downloaded 412 KB

package ‘devtools’ successfully unpacked and MD5 sums checked

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

The last line keeps appearing with everything I want to install. I tried re-instaling everything, but the problem persists.
I am using Windows 11. My R Version is 4.2.1 and my Rstudio version is RStudio Desktop 2022.02.3+492
My lib.path is :

.libPaths()
[1] "C:/Users/roman/AppData/Local/R/win-library/4.2" "C:/Program Files/R/R-4.2.1/library"

So it is not a problem with non-ASCII character is in my home directory path, as this post suggests: Hello there. I'm having a error message that I can't understand.

I will appreciate any help. Thank you very much

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.