[Rd] Rcmdr package dependencies

John Fox jfox at mcmaster.ca
Tue Sep 22 23:21:12 CEST 2009


Dear Seth,

> -----Original Message-----
> From: Seth Falcon [mailto:seth at userprimary.net]
> Sent: September-22-09 5:13 PM
> To: Uwe Ligges
> Cc: John Fox; r-devel at r-project.org
> Subject: Re: [Rd] Rcmdr package dependencies
> 
> * 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)

The Rcmdr maintains a list of its dependencies, so it already does something
similar to this, but I like your version better because it queries the
Description file directly. I can't really expect a user to issue a command
like this, so I suppose that the best solution is, as at present, to have
the Rcmdr package do the checking and installation at start-up but to
install with dep=FALSE.

Thanks,
 John

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



More information about the R-devel mailing list