wdkrnls
wdkrnls

Reputation: 4702

Trouble installing an R package using R CMD install

I just ran the following command after running R CMD build pkg and R CMD check pkg and it completed without errors.

R CMD install -t /home/wdkrnls/R/x86_64-unknown-linux-gnu-library/3.1 pkg_0.1.0.tar.gz

However, I still can't use it via library(pkg) from R. Looking in the library directory, all I see is the tarball, no pkg directory. When I try and untar it and then load in R, I get the error:

Error in library(e2pa) : 'e2pa' is not a valid installed package

Alternatively, when I try to install with

R CMD install -l /home/wdkrnls/R/x86_64-unknown-linux-gnu-library/3.1 pkg_0.1.0.tar.gz

It tells me -l is an invalid option.

Another failed possibility:

R CMD install -t /home/wdkrnls/R/x86_64-unknown-linux-gnu-library/3.1/pkg pkg_0.1.0.tar.gz install: accessing `/home/wdkrnls/R/x86_64-unknown-linux-gnu-library/3.1/pkg': No such file or directory

What is the right way to install a package into a personal library in R?

Upvotes: 1

Views: 3272

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368609

Unix commands are case-sensitive and

 R CMD install ....

as you typed invokes a different /usr/bin/install than the R-internal script INSTALL which the actually mandated form

 R CMD INSTALL ...

uses. See all the relevant docs -- it is always UPPERCASE.

Once you have the correct script, -l ... is recognised:

edd@max:~$ R CMD INSTALL -l /tmp/demo git/drat_0.0.2.4.tar.gz 
* installing *source* package ‘drat’ ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (drat)
edd@max:~$ 

Upvotes: 5

Related Questions