Re: [Rd] Calling default method for primitive functions

From: Hadley Wickham <hadley_at_rice.edu>
Date: Mon, 23 Nov 2009 17:44:51 -0600

Perfect - thanks!
Hadley

On Mon, Nov 23, 2009 at 5:22 PM, Gabor Grothendieck <ggrothendieck_at_gmail.com> wrote:
> See ?.subset
>
> On Mon, Nov 23, 2009 at 4:00 PM, Hadley Wickham <hadley_at_rice.edu> wrote:
>> Hi all,
>>
>> How can I call the default method of a S3 object defined by a
>> primitive method?   i.e. in the following example, how do I call the
>> default [ method instead of the one I defined for the class.
>>
>> new_a <- function(x) structure(x, class = "a")
>>
>> a <- new_a(1:5)
>>
>> "[.a" <- function(x, i, j, ...) {
>>  new_a(x[, j, ])
>> }
>>
>> a[, 5]
>
>

-- 
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:50:51 GMT

This archive was generated by hypermail 2.2.0 : Tue 24 Nov 2009 - 00:30:46 GMT