[R] passing a modified argument to an S3 method

CRAN.r cr@n@r @end|ng |rom proton@me
Fri Apr 19 22:36:22 CEST 2024


Is there a way to pass a modified argument from an S3 generic to a method?  Here's a non-working example that I want to return "abcd".

  test <- function(x, y = NULL){
    y <- "abcd"
    UseMethod("test")
  }
  test.default <- function(x, y = NULL) y
  test(x = 3)

Is that possible? I've looked around a lot, but can't find any examples or discussion.

Jay



More information about the R-help mailing list