[Rd] R2.6 bug in arithmetics of S4 classes inherited from 'array', or intended behavior?

From: Oleg Sklyar <osklyar_at_ebi.ac.uk>
Date: Mon, 23 Jul 2007 10:02:16 +0100


Hi,

I have an S4 class directly derived from 'array' as shown in the code below (EBImage package of Bioconductor 2.1, devel), it simply contains array adding a couple of slots:

setClass ("Image",
  representation (colormode="integer", filename="character",     compression="character", resolution="numeric", features="list"   ),
  prototype (colormode= Grayscale, filename="no-name", compression="JPEG",

    resolution=c(2.5e+6, 2.5e+6), features=list()   ),
  contains = "array"
)

No mathematical/arithmetical routines have been redefined for the class and this is what I was getting since R2.0, sum of two objects of class Image is Image again:

version.string R version 2.5.1 (2007-06-27):
> library(EBImage)
> a <- Image(0, c(2,2))
> class(a+a)

[1] "Image"
attr(,"package")
[1] "EBImage"

The same stands for

version.string R version 2.6.0 Under development (unstable) (2007-07-11 r42199)
> library(EBImage)
> a <- Image(0, c(2,2))
> class(a+a)

[1] "Image"
attr(,"package")
[1] "EBImage"

Now, in the yesterday's revision of R2.6 I get the following:

version.string R version 2.6.0 Under development (unstable) (2007-07-21 r42284)

> library(EBImage)
> a <- Image(0, c(2,2))
> class(a+a)

[1] "array"

Is this the intended behavior to fall back to the base class (same for *,/,-)? If yes, could someone point me to the following two things: what are the reasons behind and WHAT operators and functions have been affected -- I will need to redefine all those then. Moreover, it is not consistent:

> class(a*2)

[1] "Image"
attr(,"package")
[1] "EBImage"
> class(2*a)

[1] "Image"
attr(,"package")
[1] "EBImage"

Unfortunately, I do not have R versions installed between revisions 42199 and 42284, so I cannot narrow down to the particular revision.

Thanks in advance,
Oleg

-- 
Dr. Oleg Sklyar * EBI-EMBL, Cambridge CB10 1SD, UK * +441223493366

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 23 Jul 2007 - 09:05:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 23 Jul 2007 - 11:36:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.