[R] Default Generic function for: args(name, default = TRUE)
Bert Gunter
bgunter@4567 @end|ng |rom gm@||@com
Wed Mar 8 20:24:56 CET 2023
?.S3methods
f <- function()(2)
> length(.S3methods(f))
[1] 0
> length(.S3methods(print))
[1] 206
There may be better ways, but this is what came to my mind.
-- Bert
On Wed, Mar 8, 2023 at 11:09 AM Leonard Mada via R-help <
r-help using r-project.org> wrote:
> Dear R-Users,
>
> I want to change the args() function to return by default the arguments
> of the default generic function:
> args = function(name, default = TRUE) {
> # TODO: && is.function.generic();
> if(default) {
> fn = match.call()[[2]];
> fn = paste0(as.character(fn), ".default");
> name = fn;
> }
> .Internal(args(name));
> }
>
> Is there a nice way to find out if a function is generic: something like
> is.function.generic()?
>
> Many thanks,
>
> Leonard
> =======
>
> Note:
> - the latest version of this code will be on GitHub:
> https://github.com/discoleo/R/commits/master/Stat/Tools.Code.R
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list