From hadley at rice.edu  Mon Nov 23 23:56:38 2009
From: hadley at rice.edu (Hadley Wickham)
Date: Mon, 23 Nov 2009 16:56:38 -0600
Subject: [Rd] Calling default method for primitive functions
In-Reply-To: <7C7F838E-D1E3-491A-AF49-B28ED108BC82@r-project.org>
References: <f8e6ff050911231300p162230d7pad4875528b5e96ff@mail.gmail.com> 
	<7C7F838E-D1E3-491A-AF49-B28ED108BC82@r-project.org>
Message-ID: <f8e6ff050911231456o22514032m10fae2cb863b7391@mail.gmail.com>

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



[Rd] Calling default method for primitive functions
Hadley Wickham