Dear all,

In R-devel I have noticed the new approach for the "ts" class in the
package "methods".

the "structure" behaviour of "ts" is not always kept when one uses
"ts" objects and objects of classes which extend the virtual class
"structure".

As a short example:

## this works fine
setClass("foo", representation(header = "character"), contains = "structure")
foo <- new("foo", 1:10, header = "foo")
ts <- ts(1:10)
foo / ts

## but the problem appears when one defines an "Ops" method for class "foo"
setMethod("Ops", c("foo", "foo"),
           function(e1, e2) {
               .Data <- callGeneric([EMAIL PROTECTED], [EMAIL PROTECTED])
               header <- paste([EMAIL PROTECTED], [EMAIL PROTECTED], sep = "_")
               new("foo", .Data, header = header)
           })
foo <- new("foo", 1:10, header = "foo")
foo + foo
ts <- ts(1:10)
foo / ts
# Error in getDataPart(1:10) : no '.Data' slot defined for class "ts"

Is this the expected behavior?

regards,
Yohan

--
PhD student
Swiss Federal Institute of Technology
Zurich

www.ethz.ch

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

Reply via email to