开发者

error with R CMD check because of package dependency

开发者 https://www.devze.com 2023-03-14 08:03 出处:网络
Background I am creating a newpackage that depends on oldpackage, and have indicated this dependency in the file newpackage/DESCRIPTION.

Background

I am creating a newpackage that depends on oldpackage, and have indicated this dependency in the file newpackage/DESCRIPTION.

Furthermore,

  • oldpackage is installed in the directory, ~/lib/R

  • my .Rprofile includes .libPaths("~/lib/R")

    • hence, I can successfully load oldpackage without specifying the library location, e.g., using the command library(oldpackage) in R

Despite the ability to load the package without having its library 开发者_高级运维specified, R CMD check newpackage gives an error indicating that it can not fine oldpackage:

checking whether the package can be loaded ... ERROR 
Loading required package: oldpackage
Error: package 'oldpackage' could not be loaded
In addition: Warning message:
In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) :
  there is no package called 'oldpackage'
Execution halted


It looks like this package has a loading problem: see the messages for
    details.

Questions:

  1. Why is R unable to find the package?

  2. Can I specify the library location in the DESCRIPTION file?


Regarding question 1), it is both a FAQ and yet somewhat annoying. R CMD check runs in vanilla mode, so it will not find user-level libraries. As I recall, setting R_LIBS="...." in the call helps, so try that.

Regarding question 2), no you cannot give a location in DESCRIPTION. Which makes sense as that file needs to work 'everywhere' whereas your location info is local to your machine.

0

精彩评论

暂无评论...
验证码 换一张
取 消