Skip to content

Common specific @examplesIf: @examplesIfInteractive, @examplesIfInstalled + easier way to define one's own? #1697

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

Open
maelle opened this issue Feb 4, 2025 · 3 comments

Comments

@maelle
Copy link
Contributor

maelle commented Feb 4, 2025

I was wondering whether common use cases of @examplesIf could be implemented in roxygen2 as new tags.

Now if in a package one has a special way to skip examples, I see @gaborcsardi recommended creating an internal function in #1242 (comment)

@gaborcsardi
Copy link
Member

gaborcsardi commented Feb 4, 2025

I would say probably not.

For simple ones that are a single function call or an expression, there isn't a big advantage. I am not sure if @examplesIfInteractive is any better than @examplesIf interactive().

For more complicated ones, like @examplesIfInstalled, where would the code live? E.g. the code that checks if the package is installed? Embedded into the manual page? The package would need to import roxygen2? roxygen2 would add an auto-generated .R file to your project? None of these seem very good to me.

@maelle
Copy link
Contributor Author

maelle commented Feb 4, 2025

It makes sense, thank you. What about documenting the approach of using an unexported function as criterion?

@gaborcsardi
Copy link
Member

Maybe. A CRAN reviewer once told me to remove the :::, so I had to use asNamespace(...)$... instead. They probably grep the .R files for :::.

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

2 participants