Duncan Murdoch wrote:
> On 10/2/2006 3:21 PM, Herve Pages wrote:
>>> a[[x=1]]
>> Error in a[[x = 1]] : subscript out of bounds
>>
>
> Indexing is a function call, with arguments x, i, j, ... . If you use
> y=1, you're setting something in the "..." part of the arg list. If
> you say x=1, you're s
On 10/2/2006 3:21 PM, Herve Pages wrote:
> Hi,
>
>> setClass("MyList", "list")
> [1] "MyList"
>> a <- new("MyList")
>> a
> An object of class "MyList"
> list()
>> setMethod("[[", "MyList", function(x, i, j, ...) cat("Just testing\n"))
>> a[[]]
> Just testing
>> a[[1]]
> Just testing
>> a[[a=1]]
>
Hi,
> setClass("MyList", "list")
[1] "MyList"
> a <- new("MyList")
> a
An object of class "MyList"
list()
> setMethod("[[", "MyList", function(x, i, j, ...) cat("Just testing\n"))
> a[[]]
Just testing
> a[[1]]
Just testing
> a[[a=1]]
Just testing
> a[[b=1]]
Just testing
...
> a[[v=1]]
Just testing