Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
628 views
in Technique[技术] by (71.8m points)

git - How to specify lib directory when installing development version R Packages from github repository

In Ubuntu, I am installing all the R packages in the directory, /usr/lib/R/site-library by specifying lib option in install.packages().

But when I try to install the development version of the R packages using, install_github(), it always installs in a local repository of the system user.

.libPaths() has 4 directories including the local repository. So, I have 2 questions,

  1. Will it install in any of the other 3 repositories if i remove the local repository from .libPaths()?

  2. Is there any way to specify installation library path in install_github()?

I am using Ubuntu 12.04 64bit and R 3.0.1

----------------------UPDATE--------------------------------

  1. Unable to remove the local repository from .libPaths()

  2. If I try to install using install_github() in RStudio, it installs in the local repository since lib is not specified.

  3. If I try to install using install_github() as non-root user, it installs in the local repository since lib is not specified.

  4. If I try to install using install_github() as root user, it installs in the /usr/local/lib/R/site-library since lib is not specified.

Is there any to specify installation lib?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To add specified library paths in devtools, we need to use with_libpaths()

Arguments for with_libpaths() are, with_libpaths(new, code)

Following is an example for using with_libpaths(),

library(devtools)
with_libpaths(new = "/usr/lib/R/site-library/", install_github('rCharts', 'ramnathv'))

Courtesy: Hadley, here :)

And other than with_libpaths(), there are more options for in devtools::with_something()

in_dir: working directory
with_collate: collation order
with_envvar: environmental variables
with_libpaths: library paths, replacing current libpaths
with_lib: library paths, prepending to current libpaths
with_locale: any locale setting
with_options: options
with_path: PATH environment variable
with_par: graphics parameters

More explanations here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...