Re: [Rd] Calling default method for primitive functions

From: Hadley Wickham <hadley_at_rice.edu>
Date: Mon, 23 Nov 2009 16:56:38 -0600

>> 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_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 23 Nov 2009 - 23:01:11 GMT

This archive was generated by hypermail 2.2.0 : Mon 23 Nov 2009 - 23:30:40 GMT