[Rd] S4 structure classes and Ops methods

John Chambers jmc at r-project.org
Sun Feb 15 20:53:43 CET 2009


The methods package has methods for group generic "Ops" for S4 classes 
that extend "array", "structure" or "vector".  The methods mainly try to 
produce a consistent result when structures and vectors are combined.  
See class?structure, section "Methods".

In the development version of R committed today (r47924),  these methods 
will be activated by loading any package with such classes.  This was 
always the intention, but up to version 2.8.1, the methods were not 
activated UNLESS the package also defined some relevant methods itself.  
(Fixing this turned out to need a whole new mechanism, to indicate that 
the package needed the methods in question.)

Note to package maintainers: if you have a package that defines such 
classes and does not define methods for operators, method selection may 
change for objects from these classes.  In some cases, the new methods 
will be stricter (returning a vector result instead of mixing up 
attributes, for example, as the base code sometimes does).  I haven't 
encountered examples, but please rerun CMD check if you think your 
package fits the description.

John



More information about the R-devel mailing list