Re: [R] passing a modified argument to an S3 method

2024-04-21 Thread CRAN.r via R-help
; > test <- function(x){ > UseMethod("test") > } > test.default <- function(x){ > tryCatch(y, error = function(e)NULL) > } > > ## y not found > test(x=3) > NULL > > ## y found > > y <- 'abcd' > > test(x = 3) > [1] "a

[R] passing a modified argument to an S3 method

2024-04-20 Thread CRAN.r via R-help
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