[Rd] Re: NextMethod problem

2005-05-07 Thread Gabor Grothendieck
Its probably obvious but just for completeness, I missed the generic definition in pasting this into my post so I have added it below: On 5/7/05, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Can anyone shed any light on what is going wrong here? > Its based on simplifying some actual code that

Re: [Rd] how to add method to .Primitive function

2005-05-07 Thread Gabor Grothendieck
Actually I think Simon's approach is a good one. Maybe Simon's comment was really intended to say that its dangerous to redefine list operations but it should not be dangerous to define a subclass of list and override operations that way. Also since the whole purpose of this is for speed I think

RE: [Rd] how to add method to .Primitive function

2005-05-07 Thread Vadim Ogranovich
Thank you for the tip! I'll see if I can take it on to "[<-.mylist" Why do you think it will be hard to replace data frames? Insightful recently introduced a new class, largeDataFrame or something like this. This new class looks and feels like a data.frame, but they made two key simplifications:

Re: [Rd] how to add method to .Primitive function

2005-05-07 Thread Simon Urbanek
On May 7, 2005, at 2:59 PM, Vadim Ogranovich wrote: But then mylist is not a list: x <- new("mylist", x = list(x = 1, y = 2)) x[[1]] Error in x[[1]] : subscript out of bounds This is probably solvable by a sprinkle of setIs or setAs spells, but each time I get into the S4 area I feel walking a m

[Rd] [Conteúdo não permitido]

2005-05-07 Thread mailmarshal
** ATENÇÃO Esta é uma mensagem automática e não monitorada. Não responda essa mensagem, pois ela não será lida. **

RE: [Rd] how to add method to .Primitive function

2005-05-07 Thread Vadim Ogranovich
But then mylist is not a list: > x <- new("mylist", x = list(x = 1, y = 2)) > x[[1]] Error in x[[1]] : subscript out of bounds This is probably solvable by a sprinkle of setIs or setAs spells, but each time I get into the S4 area I feel walking a mine-field. All this exercise on my part was to wr

[Rd] NextMethod problem

2005-05-07 Thread Gabor Grothendieck
Can anyone shed any light on what is going wrong here? Its based on simplifying some actual code that exists in model.frame.default. It looks like a bug to me. Thanks. data(iris) f.default <- function(x, subset, ...) { subset <- eval(substitute(subset), iris, .GlobalEnv) subset } # This on

Re: [Rd] how to add method to .Primitive function

2005-05-07 Thread Gabor Grothendieck
On 5/7/05, Vadim Ogranovich <[EMAIL PROTECTED]> wrote: > I tried to write the dim method for the list class, but R doesn't seem > to dispatch to it: > > dim.list = function(x) c(length(x[[1]]), length(x)) > > dim(list(1)) > NULL > > dim.list(list(1)) > [1] 1 1 > > What is the correct way of regist

Re: [Rd] how to add method to .Primitive function

2005-05-07 Thread Prof Brian Ripley
On Sat, 7 May 2005, Vadim Ogranovich wrote: I tried to write the dim method for the list class, but R doesn't seem to dispatch to it: dim.list = function(x) c(length(x[[1]]), length(x)) dim(list(1)) NULL dim.list(list(1)) [1] 1 1 What is the correct way of registering dim.list with .Primitive("dim"

[Rd] how to add method to .Primitive function

2005-05-07 Thread Vadim Ogranovich
Hi, I tried to write the dim method for the list class, but R doesn't seem to dispatch to it: > dim.list = function(x) c(length(x[[1]]), length(x)) > dim(list(1)) NULL > dim.list(list(1)) [1] 1 1 What is the correct way of registering dim.list with .Primitive("dim")? Thanks, Vadim