Hello everybody
[R-2.12.1]
I am having difficulty dealing with Oarray objects.
I have a generic function, call it foo(), and I wish
to define a method for Oarray objects.
I do not have or want a method for regular arrays [actually,
I want to coerce to an Oarray, and give a warning].
But setMethod() does not behave as desired, giving
an error message when I try to define a method for
Oarray objects.
Also, if I define a method for array objects, this does not
give an error message, but neither does it behave as desired,
as the method is not found when passing an Oarray object
to foo().
LE110:~/packages% R --vanilla --quiet
library(Oarray)
setGeneric("foo",function(x){standardGeneric("foo")})
setMethod("foo","Oarray",function(x){x})
in method for ?foo? with signature ?"Oarray"?: no definition for class "Oarray"
[1] "foo"
setMethod("foo","array",function(x){x})
a <- Oarray(0,2:3)
is.array(a)
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "foo", for signature "Oarray"
Three questions:
Why does the first call to setMethod() give an error message?