>> new_a <- function(x) structure(x, class = "a")
>>
>> a <- new_a(1:5)
>>
>> "[.a" <- function(x, i, j, ...) {
>>  new_a(x[, j, ])
>
> What about
> new_a(unclass(x)[, j,])

That's what I'm currently using, but I'm concerned about the
performance implications - won't that create a copy of x?

Hadley


-- 
http://had.co.nz/

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

Reply via email to