John Fox wrote:
Dear Seth,

-----Original Message-----
From: Seth Falcon [mailto:s...@userprimary.net]
Sent: September-22-09 5:13 PM
To: Uwe Ligges
Cc: John Fox; r-devel@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)


Nice suggestion, indeed! I think there is some code in package "tools" that help to resolve these issues even more convenient:


wantPkgs <- package.dependencies(available.packages()["Rcmdr",], depLevel = "Suggests")[["Rcmdr"]][,1]

so you do not need to have Rcmdr already installed and can rely on the R internal code that can strip all that version information.

Best wishes,
Uwe





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



______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to