You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
R 3.6 introduce a new way to use S3method in NAMESPACE: S3method(knitr::knit_print, class)
Oh I didn't know that. That seems to be the simplest method. From what I understand, it doesn't require knitr to be in Imports, I'd advocate this method. The requirement for R >= 3.6.0 doesn't sound too bad to me (v3.6.0 was released on 2019-04-26, which feels like a century ago now? :)
But other methods can certainly be mentioned in the vignette.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
Context
R 3.6 and R 4.0 have change things for S3 methods lookup and the search is not more used.
This has caused so issue in certain packages that where not following closely the advice in the vignette
vegawidget/vegawidget#132 (comment)
The vignette should be updated with more examples and mention of the importance of exporting due to this new behavior
https://cran.r-project.org/web/packages/knitr/vignettes/knit_print.html#for-package-authors
Different solutions:
Import the generic and package export S3 method
The package must be in Import in the DESCRIPTION file
Register the method dynamically
vctrs
has a helper for that:register_s3_method
- that can be copied - pasted as MIT licenced.S3method()
See examples for some of this:
Delayed registration
R 3.6 introduce a new way to use
S3method
in NAMESPACE:S3method(knitr::knit_print, class)
With rogygen2 it is
The text was updated successfully, but these errors were encountered: