[Rd] Rcmdr package dependencies

Seth Falcon seth at userprimary.net
Tue Sep 22 23:12:57 CEST 2009


* On 2009-09-22 at 20:16 +0200 Uwe Ligges wrote:
> no, this is not possible.
> 
> Consider your package A (or Rcmdr) suggests B that suggests C.
> Then A::foo uses the function B::bar which only works if C::dep is
> present. B works essentially without C but it requires C just to
> make bar work. Then this means your A::foo won't work if C is not
> installed and you won't get it with the setup mentioned above.
> 
> In summary, I fear what you want might work well *now* (by chance),
> but it does not work in general.

In general, one would expect a given package to function when its
suggested packages are not available.  As such, it seems quite
reasonable to install a package, its Depends, Imports, and Suggests,
but not install Suggests recursively.

I think you could achieve such an installation using two calls to
install.packages:

install.packages("Rcmdr")
Rcmdr.Suggests <- strsplit(packageDescription("Rcmdr")$Suggests, ",\\s?")[[1]]
## need extra cleanup since packageDescription("blah")$Suggests
## Returns package names with versions as strings
wantPkgs <- sub("^([^ ]+).*", "\\1", Rcmdr.Suggests)
havePkgs <- installed.packages()[, "Package"]
wantPkgs <- wantPkgs[!(wantPkgs %in% havePkgs)]
install.packages(wantPkgs)

+ seth

-- 
Seth Falcon | @sfalcon | http://userprimary.net/user



More information about the R-devel mailing list