;
> 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
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
2 matches
Mail list logo