search for: obj_par

Displaying 1 result from an estimated 1 matches for "obj_par".

Did you mean: obj_ptr
2019 Aug 07
1
NextMethod() and argument laziness
...pected), but I would have also expected to get `mpg` back when calling it from the `child` method. my_generic <- function(x, cols) { UseMethod("my_generic") } my_generic.parent <- function(x, cols) { substitute(cols) } my_generic.child <- function(x, cols) { NextMethod() } obj_parent <- structure(mtcars, class = c("parent", class(mtcars))) obj_child <- structure(obj_parent, class = c("child", class(obj_parent))) my_generic(obj_parent, mpg) #> mpg my_generic(obj_child, mpg) #> cols Thanks, Davis [[alternative HTML version deleted]]