2

Updated:

When I open RStudio and enter Sys.getenv("HOME"), I get:

[1] "C:/Users/Clayton/Documents"

When I open git-bash, and enter Rscript -e "Sys.getenv('Home')" I get:

"C:\\Users\\Clayton"

This means Rscript and R can't load my packages from the command line. How can I set my Rscript -e "Sys.getenv('HOME')" permanently to:

"C:\\Users\\Clayton\\Documents"

As a very terrible solution I copied all of my packages into another library folder that works with the Rscript home environment.

I have looked at Rscript: There is no package called ...?, but the answers aren't for making permanent change to R or Rscript. The comments here showed me what my problem wasn't Rscript "there is no package". This also did not provide a solution Running Rscript in command line and loading packages.

Thank you for any help.

Community
  • 1
  • 1
Tunn
  • 1,506
  • 16
  • 25
  • Whoever down voted can you give a reason please. I think I made this pretty clear. – Tunn Nov 11 '16 at 04:57
  • (Wasn't me.) This is a garden-variety Windows setup issue. Google 'how to set environment variables' in Windows and make sure you set it system-wide. They key is to a) have it system-wide before the applications start and b) not to then overwrite it again their configs. – Dirk Eddelbuettel Nov 16 '16 at 00:57
  • @DirkEddelbuettel Thank you. – Tunn Nov 16 '16 at 01:08

1 Answers1

1

In case anyone has a similar issue and wants a concrete answer, this solution worked:

Create and/or open your .bash_profile file. Add this line with the path to your R library:

export R_LIBS="C:/Users/Clayton/Documents/R/win-library/3.3"
Tunn
  • 1,506
  • 16
  • 25