-
Notifications
You must be signed in to change notification settings - Fork 38
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
withr not working properly in pkgdown examples #230
Comments
AFACIT, this is expected behaviour. Here is a relevant section from R Packages book: ![]() I am also not sure how to proceed, and this is also why we haven't been able to fix a documentation issue in |
Yeah, this is the expected behaviour when |
Ooops, no, this is only the expected behaviour when called from examples. It looks different when called from the global environment. @lionel- I think the best we can do here is remove that example, since as far as I can there's no easy way to simulate what it'll look like when run manually in the global environment. (e.g. even if you eval specifically in the global environment then it code and results won't be interleaved correctly). |
In:
https://withr.r-lib.org/reference/defer.html#ref-examples
and:
https://withr.r-lib.org/dev/reference/defer.html#ref-examples
The examples show incorrect output:
The deferred expressions are evaluated immediately, rather than when
withr::deferred_run()
is called. This behaviour can be reproduced locally by cloning the repository and runningdevtools::build_site()
.I'm experiencing this issue in a package of mine that relies heavily on withr to manage local state. In my experience, examples seem to work fine when run using
devtools::run_examples()
and insideR CMD CHECK
. You can also see the issue occur here:https://lintr.r-lib.org/reference/linters_with_defaults.html#ref-examples
Is this a known issue, and is there a workaround?
The text was updated successfully, but these errors were encountered: