[Rd] S4 Methods dispatch

Seth Falcon sfalcon at fhcrc.org
Wed Aug 30 19:22:38 CEST 2006


"Henrik Bengtsson" <hb at stat.berkeley.edu> writes:

> [Cross-posting to BioC-devel to]

I'll answer here for now.

> Is there an easy way to detect if a package is using S4 or not?  If
> so, I could scan my already installed libraries and call
> install.packages() on its S4 subset of packages.  The alternative is
> to do install.packages() an all libraries (sic!).  Bioconductor: maybe
> biocLite() could have such an update mechanism built in internally?

This really is only an issue for developers and those living on the
bleeding edge.  That is, when upgrading R, one generally reinstalls
all packages anyhow (at least that is what I do).

> If I miss to reinstall one S4 package, what should I expect?  I assume
> there will be an error, but I just want to confirm that there is no
> risk of getting weird "results" but still a running program?

Not sure, but in some testing I know that in at least _some_ cases,
one does get an error message.

> Reinstallation is also required for all package that comes as Windows
> binaries, correct?

But one has to reinstall binaries when upgrading R anyway.  Unless I'm
missing something, I would say this is a case where developers and
those on the bleeding edge just have to bite the bullet and
reinstall.  

As for identifying S4 using packages, I think it is the case that such
packages will have one or more of the following:

1. methods package in Depends
2. methods package in Imports
3. import or importFrom methods in NAMESPACE
4. a call to setClass, setMethod, or setGeneric in R sources (harder
   to identify)

Items 1 and 2 above would be easy to pull out of the return value of
installed.packages().

Best,

+ seth



More information about the R-devel mailing list