Rainer
Rainer

Reputation: 8671

R CMD check with specified library path

I am working on a package which I can load using devtools. But

R CMD check asm

gives me an error message

Error : package ‘seedDisp’ required by ‘asm’ could not be found

Which is kind of obvious as it is not installed in the global library.

But: I have installed installed in a local library (./library) and I have a .Rprofile file in the directory from which I run the checks as follow:

.libPaths(normalizePath("library"))

So when I run R and use devtools and load_all(.) it loads as the package seedDisp is installed.

It seems that R CMD check does ignore the library location which is set via the .Rprofile file.

So I tried

 R CMD CHECK -l ./library asm_0.0.1.tar.gz 

but it seems that -l only is used to install in and not to look for installed packages.

How can I tell R CMD check to look for installed packages in the library at ./library ?

Upvotes: 3

Views: 3003

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368261

One way to do this is via the R_LIBS_USER variable so I generally do

R_LIBS_USER=/some/other/path R CMD check asm_0.0.1.tar.gz

If that variable is generally set on your system, you need to do the usual trick of appending, or just set it in your shell via e.g.

export R_LIBS_USER="/some/other/path:${R_LIBS_USER}"
R CMD check asm_0.0.1.tar.gz

This mechanism is independent of how you call R CMD check it will work with or with devtools.

Upvotes: 5

Related Questions