[Rd] Calling default method for primitive functions

Hadley Wickham hadley at rice.edu
Mon Nov 23 22:00:05 CET 2009


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]

Thanks,

Hadley

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



More information about the R-devel mailing list