I have a brand new laptop with freshly installed R and RStudio.
When I open RStudio, the following error message pops up:
Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:/Users/tianj/OneDrive/??": The filename, directory name, or volume label syntax is incorrect
I checked environment variables, there are two entries that seemed to be wrong:
HOME C:/Users/tianj/OneDrive/??
R_USER C:/Users/tianj/OneDrive/??
I believe ??
here must be 桌面
which is actually Chinese alias of desktop
. I googled a lot, it seems that the only way to modify env variables permanently is to create a .Renvrion
file at ~/
, however, in my case ~/
doesn't even exist. usethis::edit_r_environ
also gives an error:
Error: [EINVAL] Failed to make directory 'C:/Users/tianj/OneDrive/??': invalid argument
I also tried to add env variables in Windows settings:
R_USER=C:/Users/tianj
but then another issue would appear:
'C:/Users/tianj/../Downloads/rest_of_the_path_to_file', probable reason 'No such file or directory'
R (or actually RStudio?) will add excess ../
in the path. So I have to remove env variables from Windows system.
Because of the issue, I cannot open or save any file using RStudio's interface, though relative R functions work without a problem.
How can I fix this issue? Is there another way to change default environment variables?