Hi R-Help,

Please consider the following simple case: I have a class like

setClass("myClass",
               representation(x="matrix", y="character"))

and I would like to use the method *"["* for a *myClass* objects (but
changing the default *drop* argument from TRUE to FALSE):

setMethod("[","myClass",
function(x,i,j,...,drop=FALSE)
{
    x <- x@x
    callNextMethod()
    x<-as.myClass(x)
}
)

suppose that *as.myClass* method has been already defined. Actually, all I
want is to pass all the arguments to *"["* method for *matrix*, except
changing the default behaviour for *drop*.

When I execute:
> test<-new("myClass",x=cbind(1:3,4:6),y="a")
> test[1,] # works as expected
[1] 1 4

> test[1,drop=TRUE] # does not work
Error: argument "j" is missing, with no default
Error in callNextMethod() : error in evaluating a 'primitive' next method

but with a matrix the two cases work:
> m<-cbind(1:3,4:6)
> m[1,]
[1] 1 4
> m[1,drop=TRUE]
[1] 1

Can you please advise me a solution for this problem?
Thank you in advance for the help.

Musa

	[[alternative HTML version deleted]]

