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

2024-04-20 Thread Bert Gunter
I do not understand what your goal is here (more context may be helpful, perhaps to others rather than me). So I doubt this is what you want, but here is a guess -- no need to respond if it is unhelpful: ## test.default returns NULL if object "y" not found in **calling environment and

[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

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

2024-04-20 Thread Jeff Newmiller via R-help
The parameters in a specific call to a function are stored in a special list which is used to move/copy data from the calling environment into the environment created for a particular function call. UseMethod does not act like a normal function call... it does a kind of magic substitution of

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

2024-04-20 Thread Bert Gunter
## Neglected to cc to list -- Forwarded message - From: Bert Gunter Date: Sat, Apr 20, 2024 at 1:26 PM Subject: Re: [R] passing a modified argument to an S3 method To: CRAN.r Well, my interpretation of your explanation is as follows: You have a long list of "control" values,

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

2024-04-20 Thread Berry, Charles via R-help
> On Apr 19, 2024, at 1:36 PM, CRAN.r via R-help wrote: > > 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". > grep-ing the source code is often a good way to answer a question like this. Particularly,