tpemartin / 110-1-r4ds-main

MIT License
3 stars 73 forks source link

Question on r-studio installation #6

Open Michael1598746 opened 2 years ago

Michael1598746 commented 2 years ago

Professor, I already re-installed my r and r-studio, and I am pretty sure that there aren't any chinese words in their installation path. However, when I tried to run any code in r-studio, it still continually display the following code:

Warning message: In normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:/Users/m6022/OneDrive/??": 檔案名稱、目錄名稱或磁碟區標籤語法錯誤。

Besides, when I tried to install a new package, it will show a label that said:

would you like to create a personal library 'C:// Users/m60227m/OneDrive/??/R/win-liberary/4.1' to install packages into.

but I can't do anything whether I choose yes or no.

Below are the installation path of my R and R-studio respectively C:\Program Files\R\R-4.1.1 C:\Program Files\RStudio

tpemartin commented 2 years ago

I think your problem is related to the fact that you don't have the permission to write files in your \R-4.1.1 folder.

Check https://hyp.is/rTanMiEuEeyZZQMR2A1BzQ/cran.r-project.org/bin/windows/base/rw-FAQ.html (4.2 I don’t have permission to write to the R-4.1.1\library directory)

tpemartin commented 2 years ago

You can run Sys.setenv("R_LIBS")="....the directory you want to install your packages" whenever you start your R, like

Sys.setenv("R_LIBS")="C:\myRLib"

given that the directory exists. But you need to run that one whenever you start R. A better method is to put

R_LIBS="C:\myRLib"

in your .Renviron file as we demonstrated during the class.

tpemartin commented 2 years ago

@Michael1598746 You read a more detailed discussion in https://gitter.im/110-1-r4ds/main?at=61549c0ed3ae402e471f0fba

Michael1598746 commented 2 years ago

Thank you, professor! After I tried the instruction in your latest reply, my problem was finally fixed!