Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message of method_from_call() on S3 methods #74

Open
DanChaltiel opened this issue Feb 4, 2023 · 0 comments
Open

Better error message of method_from_call() on S3 methods #74

DanChaltiel opened this issue Feb 4, 2023 · 0 comments

Comments

@DanChaltiel
Copy link

Hi,

method_from_call() works only on S4 methods and not on S3 methods.

Indeed, the doc says "find corresponding S4 method", but it never explicitly tells us it cannot find S3 methods.

If this is a technical limitation, I think it would be worth mentioning it in the doc, maybe in a @details section (and likewise if it is a WIP).

Moreover, it is not evident for a naive user (like me) whether a method is S3 or S4, and the error message is not very helpful:

pryr::method_from_call(mean(1:10))
#> Warning in formals(fun): argument is not a function
#> Error in getGeneric(f, !optional): no generic function found for 'mean'

Created on 2023-02-04 with reprex v2.0.2

Note that this reprex is oddly only really reproducible inside reprex(): in a fresh R session, a mean() call will work, but an anova() call will not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant