-
Notifications
You must be signed in to change notification settings - Fork 233
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
examplesIf doesn't work when documenting the methods of an R6 class #1521
Comments
Yes, this is documented at https://roxygen2.r-lib.org/articles/rd-other.html#r6:
|
Ah, so it is. Thanks! |
Could this be reopened as a feature request? It is a useful tag to have to protect against suggested packages that are used in examples not being installed. Alternatively, support the |
While checking for other issues I noticed in the examples some mismatch between the text and the result. I also observed some differences between the options on the code and the documented options. While checking the package I saw: ``` ─ checking examples ... [22s] OK (23.2s) Examples with CPU (user + system) or elapsed time > 5s user system elapsed Reporter 2.61 0.14 7.09 Renderer 2.30 0.30 7.74 ``` The problem might come from each method creating a new card and reporter, see r-lib/roxygen2#1521 for the underlying issue and linked issues here.
When
@examplesIf
is used instead of@examples
whilst documenting an R6 method, the example is treated as separate from the method (i.e. only documenting the class).I've created a reproducible example here: https://github.com/ashbythorpe/roxygen2examples
A simple class is created, with two documented methods: one which uses
@examples
and one which used@examplesIf
:I would expect the two examples sections to be rendered in the same way. Instead, the following is produced:
https://ashbythorpe.github.io/roxygen2examples/reference/MyClass.html
https://github.com/ashbythorpe/roxygen2examples/blob/a94f2bbdb9ebf9e1a71b06e20d4aab52e767a823/man/MyClass.Rd
The text was updated successfully, but these errors were encountered: