dependent packages not loading in R on Debian
I'm having trouble loading the sde
package on a clean Debian install running R 2.11.1. I've seen this behavior with some other packages, however, so I don't think it's specific to only this one package. Here's an example of the conundrum:
>install.packages("sde", lib.loc=libPath)
... installs sde, and the packages it's dependent on: zoo, fda
> library(sde, lib=libPath)
Loading required package: fda
Error: package 'fda' 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 'fda'
ok, that's odd. I saw fda being installed. So I manually load the dependencies:
> libra开发者_StackOverflow社区ry(zoo, lib=libPath)
> library(fda, lib=libPath)
Loading required package: splines
ok, that worked. Now let's try sde:
> library(sde, lib=libPath)
To check the errata corrige of the book, type vignette("sde.errata")
WTF? it loaded fine?!?
So why can I manually load the packages but R is not picking them up automagically?
Adding to my confusion, I discovered during debugging that if I don't use the lib=libPath
then everything works just fine. So it looks like the use of a custom path for packages is screwing this all up... but why?
You confirmed my suspicions in the comments. You need to do one of two things:
.libPaths(libPath)
or
library(sde, lib=c(libPath,.libPaths()))
I prefer the first method because the second requires you do that for all calls to library
.
精彩评论