Roxygen comments involve prefixing lines with #'
.
When writing and testing examples for functions, it's nice to be able to toggle the comments on and off. I could copy and paste the code back and forward to vim and remove or add those comments, but that's not very elegant.
- Is there any easy way to toggle roxygen comments in Rstudio?
- Alternatively, is there another way to efficiently run example R code that is commented out by roxygen comment characters?
Update: Thinking laterally, I suppose using @example examples/foo.r
is an alternative way of avoiding having to use Roxygen comments for the actual example code (i.e., by sourcing the example from a file, i.e., examples/foo.r
).
if(TRUE/FALSE) {}
. You can toggle that with one letters. – Grussing