pain in the butt
When OneDrive was installed in a computer, it’s painful using R and Rscirpt in command line.
Since the
Documents
has been hijacked by OneDrive, whenever you open the directoryC:\User\YourName\Documents
it automatically redirects toC:\Users\YourName\OneDrive - Spectrum Health\Documents
. You don’t want to backup 2-GB R library fold to the OneDrive.- How to reach the real
C:\User\YourName\Documents
instead ofC:\Users\YourName\OneDrive - Spectrum Health\Documents
, you have to goC:
drive, thenUser
folder, thenYourName
folder, thenDocuments
.
- How to reach the real
- R’s default environemnts
- Home directory is
C:\Users\YourName\OneDrive - Spectrum Health\Documents
- User library (R_LIBS_USER) is
C:\Users\YourName\OneDrive - Spectrum Health\Documents\R\win-lib\R-version
- Home directory is
Change R
envrionments
- Change
.Renvrion
underC:\Users\YourName\OneDrive - Spectrum Health\Documents
HOME=C:/Users/YourName
R_USER=C:/Users/YourName
R_LIBS_USER=C:/Users/YourName/Rpackages
R_LIBS=C:/Program Files/R/R-3.5.2/library
- Copy the above
.Renvrion
toC:\User\YourName\
Change Rscript
envrionments
In command line, set the following PATHs before
Rsciprt R_Script.R
set HOME=C:/Users/YourName set R_USER=C:/Users/YourName set R_LIBS_USER=C:/Users/YourName/Rpackages Rsciprt R_Script.R
- In Task Scheduler of .bat file
Same as command line, those PATHs must be set beforeRsciprt R_Script.R
- Google Analytics authentication
Addga_auth(token = "C:/Users/CHU83456/.httr-oauth")
in yourR_Script.R
- Google Analytics authentication