[Rd] Calling default method for primitive functions

Hadley Wickham hadley at rice.edu
Mon Nov 23 23:56:38 CET 2009


>> 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/



More information about the R-devel mailing list