2

I have a set of libraries needed to be installed for different users, how to specify it in .libPath() and in install.packages()? Otherwise, by default, it is going to global space and throwing the error (is not writable) message when I try it within an RScript.

ARJ
  • 2,021
  • 4
  • 27
  • 52

1 Answers1

1

You can add your default .libPath() by giving the first entry of libPath another path value

new_path <- "./Desktop"
.libPath(new_path)

or simply .libPath("./Desktop")

And it got changed

you can check it by using

libPath()

Explanation: install.packages() is using the first value of .libPath() as default. Also if you don't want to change the default you can also using install.packages(pkg, lib="~/Desktop"). Just edit it for your anaconda path.

Also see this old question here. You can also append an old library to a new one by following this

mischva11
  • 2,811
  • 3
  • 18
  • 34
  • What if I need to run the whole thing as Rscript on as a command line argument? Say, I would like to give all these in a .R file? – ARJ May 16 '19 at 20:56
  • @user1017373 i don't understand this question. This is normal R syntax, just put it in your R file or the command line. – mischva11 May 17 '19 at 10:01