1

When trying to use RStudio and installing packages, I get the following error messages:

Error in nchar(homeDir) : invalid multibyte string, element 1
In normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:/Users/J�r�me/Documents": Le chemin d’accès spécifié est introuvable.

I’ve looked online and contacted different people for help, but without any success. The only solution I found was this line of code that doesn't work ""Sys.setlocale( 'LC_ALL','C' ) ""

I am at a loss and need to use this program both for my masters project and for some classes. Any help is greatly appreciated.

Rui Barradas
  • 70,273
  • 8
  • 34
  • 66
Eluge458
  • 11
  • 1

1 Answers1

0

There seems to be a problem with Multibyte Characters (like á or Ô). Ref here

I guess homeDir is a variable created by you, and not R's home directory.( Which can be found by running R.home() )

I think you might be able to avoid this problem if you do not use user-specific locations like the Documents folder. Instead, create a folder directly on the root of drive. For example - make a folder D:\Rprojects , and place both your scripts and data within that folder. Windows user name will not come into picture when dealing with this path.

As for setting locale to C, the C locale copies the default for C programming language and is North-American centric as per the documentation. You can try setting locale to fr. See this reference

R.S.
  • 2,093
  • 14
  • 29
  • I have not added homeDir, it was just that way when I installed and opened RStudio. I have tried installing both R and RStudio in a file that was named "R" in my C: drive. Although I suppose it would be a good idea to try and install them in my other drive that doesn't have any mention of the user. – Eluge458 Sep 11 '22 at 02:03
  • Although i've installed everything in another drive (D:) the path still considers C: in the "Normalizepath" error message. Is this normal? Seems odd to me. – Eluge458 Sep 11 '22 at 02:10
  • @Eluge458 Ok. I did not expect homedir to be in camel-case. Anyway, are you sure RStudio is using the same R version that you have manually installed ? You can check that by `running R.home() in both RStudio and R in Dos prompt` . Also , it seems Windows user can set a different Home Folder specifically for R by setting the `R_USER` environment variable. Take a look at the replies on this page https://stackoverflow.com/questions/47732049/change-home-directory-for-r , especially the one by mike-m – R.S. Sep 11 '22 at 04:28