So I'm submitting my package to CRAN and I am confused about when to wrap examples in \donttest
or \dontrun
. I have a few different cases:
- Examples that return data frames, etc.
- Examples that return static figures generated via ggplot2
- Examples that return JavaScript figures generated via plotly
- Examples that read or write to the file system (e.g. importing data, and writing spreadsheets)
- Examples that run Shiny apps
I have worked out that for (1) I should never wrap in \donttest
or \dontrun
. For (5) I should wrap the whole function in if(interactive()){}
.
That still leaves cases 2-5 where I am not sure if I should leave the examples wrapped or un-wrapped. I am guessing that plots are ok but not sure about reading/writing files. Any hints or directing me to somewhere where it is clearly explained is much appreciated. Thanks.
\dontrun
make sure to add comment during package submission on why you have used it.