Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package dependencies when installing from source in R

Tags:

r

cran

Just confirming: If I distribute my R package as ZIP/TAR then installing the package will not automatically download/install dependencies because I have to set repos = NULL in install.packages() and dependencies parameter is not used if repos = NULL? The way to possibly get this to work is to package an install script. Is that possible? Am I completely missing something here and there is a mechanism to install from source AND automagically download and install dependencies?

like image 581
SFun28 Avatar asked Apr 27 '11 13:04

SFun28


People also ask

How can we install packages in R with all dependencies?

Remember in R, Boolean (TRUE and FALSE) must be all capital letters or R will not recognize them as Boolean. At the top, got to Tools and select Install Packages from the drop down. Finally, make sure install dependencies and checked and click install.

How do I specify a library when installing a package in R?

R uses a single package library for each installed version of R on your machine. Fortunately it is easy to modify the path where R installs your packages. To do this, you simply call the function . libPaths() and specify the library location.


2 Answers

The devtools package has a function install. If used on a directory containing the source code for an R package, it will install that package and download any dependencies from CRAN.

like image 184
sebastian-c Avatar answered Oct 20 '22 11:10

sebastian-c


You could make your own repository and set repos to be a vector of the places to look for packages, where it would start with your own repository and then include a link to a CRAN mirror. This is what I do and it works quite nicely, as then I can easily share my packages with others and update them from whatever computer I happen to be on.

like image 34
Aaron left Stack Overflow Avatar answered Oct 20 '22 10:10

Aaron left Stack Overflow