I have the Warning message below that appears every time that I open RStudio. I have managed to ignore it, but now it is not letting me install any packages from GitHub. In normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:/Users/Username/OneDrive/company name/Documents"
The company name has Non-ASCII characters, which I assume is the problem. However, when I look at my system environment variables, there are only two variables related to the Onedrive with the non-ASCII character: OneDrive & OneDriveCommercial.
If I run path.expand("~") or normalizePath("~") the path is to the OneDrive folder.
I have tried to fix it by adding in the .Rprofile the following 2 lines:
I just had my company computer updated to w11 this week and after reinstallation of R Studio I also have this issue where my "~" path is "C:/Users/Username/OneDrive - company name/Documents/" and the company name has a unicode character in it. I have tried on Rgui for r4.2.1 and those methods work fine so it's an R Studio issue. Specifically with the path.expand("~") command as other expansions or normalizations of paths with the same character work as intended.
I have also noticed that I'm missing the a few environment variables when comparing Sys.getenv() of R studio to that of Rgui, notably HOME and R_USER which both have the problem character included. Possibly because it never gets stored due to this error on startup? I wonder if there's a way to manually set this during startup in the Renviron.site file.
I did notice the IT guy install R and R studio at the same time and R finished afterwards. I might try reinstallation to see if that somehow magically fixes my "~" and environment variables.
@shiame I have found a solution that works for me that you might have luck with as well.
The "~" shortcut appears to be bound the first time that path.expand("~") is called and by default is set to your R_USER environment variable. I found that I did not have a R_USER so for some reason it was pulling a raw string of my document directory. I forced one to be loaded by creating a Renviron.site file in the C:\Users\%USERNAME%\AppData\Local\Programs\R\R-4.2.1\etc directory that consist of the following line, of course replacing "Company name" with yours, non-ASCII characters and all: