-
Notifications
You must be signed in to change notification settings - Fork 235
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
apply knitr print method for inline r code #1193
Conversation
22bb8c8
to
194b766
Compare
Do you want to try and get this into this release? I'm aiming for release around the end of next week. |
We could finish this one off too, if you wanted? |
this avoids an error message on an old release which does not support the `after = FALSE` argument in `on.exit()`
I'm happy with this now, I think it's ready for review. I have:
@hadley you've previously r-lib/testthat#1308 recommended not to be too clever about reusing code between tests and documentation, because it makes the tests harder to read.
Does that seem ok to you @hadley? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! I do think it's better to make the tests self-contained even if it leads to some repetition. See my explanation below.
this duplicates the vignette, but should stay in place
Co-authored-by: Hadley Wickham <h.wickham@gmail.com>
Co-authored-by: Hadley Wickham <h.wickham@gmail.com>
these used to be reused between tests and vignette, but that is discouraged
@hadley thanks for the thorough review -- very instructional. Hope I addressed everything ok and the tests still pass 🙏. |
Thanks! |
This replaces the custom roxygen2 evaluation of inline code with default knitr inline.
As such, this enables
knit_print()
methods and closes #1179.I'll list the potential problems with this first:
knit_print()
methods are applied (which might not always work with the roxygen2 markdown engine)`r x <- 10`
would yield[1] 10
.Knitr (and console) behavior is to print nothing in this case.
I've changed the tests accordingly, but this might bite some (hopefully very few?) people.
Since the whole dynamic R was marked as a beta feature, perhaps this minor breaking change is acceptable.
Advantages include:
knit_print()
and some other niceties.To the extend that they pertain to inline dynamic R code, I've also streamlined the tests and documentation:
Remaining todos before this read for review: