Skip to content

[Bioc-devel] 80% of man pages must have runnable examples (package with numerous Shiny apps)

5 messages · Shepherd, Lori, L Rutter, Kevin RUE

#
Hello all:

I am planning to submit a package to Bioconductor and have one last
item from BiocCheck (error, warning, note) I have been unable to
resolve:

ERROR: At least 80% of man pages documenting exported objects must
have runnable examples. The following pages do not: plotLitreApp.Rd,
plotPCPApp.Rd, plotSMApp.Rd, plotVolcanoApp.Rd

I have 18 man pages (9 function-related, 8 data-related, and 1
package-related). Of these, 4 of the function-related man pages (the
ones listed in the ERROR) are Shiny applications of the following
format:

appDir <- system.file("shiny-examples", "plotLitreApp", package = "bigPint")
shiny::runApp(appDir, display.mode = "normal")

If I do not have \dontrun{} around these shiny app examples, then R
CMD check permanently halts on the "checking examples..." step. If I
do have \dontrun{} around these shiny app examples, then R CMD
BiocCheck gives me the error above. My question is: What is the
recommended procedure in such a situation where the package is being
prepared for Bioconductor submission?

An example of one script causing the error can be found at:
https://github.com/lrutter/bigPint/blob/master/R/plotLitreApp.R

Thank you for any advice!
Lindsay
#
Submit with the dontrun{} and temporarily ignore the ERROR -  when submitting please reference the explanation below.  Your reviewer could provide more information and will decide how to proceed -  generally examples will be run manually to check for accuracy and an exception can be made.


Lori Shepherd

Bioconductor Core Team

Roswell Park Cancer Institute

Department of Biostatistics & Bioinformatics

Elm & Carlton Streets

Buffalo, New York 14263
#
Hi Lindsay,

Check out https://github.com/csoneson/iSEE/blob/master/R/iSEE-main.R
function "iSEE" for an example of both the function return value, and the
man page.

First, I would suggest that your function _returns_ the "appDir" object to
the user, and that you leave it to the user to call "shiny::runApp" with
options appropriate to their system or preferences (e.g
launch.browser=FALSE, port=1234, etc).

Second, for the man page, you don't have to put the _entire_ @example block
inside \dontrun{}. You can put everything that doesn't launch the Shiny app
outside the \dontrun{} block and only put the one "shiny" line inside the
\dontrun{}. The one line will represent less than 80% of the man page.

However, even better, you can avoid the \dontrun{} option altogether and
put the "shiny" statement within a "if (interactive()) { ... }" block.

So adapting you existing code, I would have
#' @examples
#' # Example 1: Create an interactive litre plot for the logged data using
#' # default background of hexagons.
#'
#' data(soybean_ir_sub)
#' data(soybean_ir_sub_metrics)
#' soybean_ir_sub_log <- soybean_ir_sub
#' soybean_ir_sub_log[,-1] <- log(soybean_ir_sub[,-1]+1)
#' if (interactive()){
#' plotLitreApp(data = soybean_ir_sub_log, dataMetrics =
soybean_ir_sub_metrics)
#' }
#'
#' # Example 2: Repeat the same process, only now plot background data as
#' # individual points. Note this may be too slow now that all points are
drawn
#' # in the background.
#' if (interactive()){
#' plotLitreApp(data = soybean_ir_sub_log, dataMetrics =
soybean_ir_sub_metrics,
#' option = "allPoints", pointColor = "red")
#' }

However, once more, I suggest that you return "appDir", and you would then
have something like:
#' app <- plotLitreApp(data = soybean_ir_sub_log, dataMetrics =
soybean_ir_sub_metrics)
#' if (interactive()){
#'    shiny::runApp(app, [options defined by your user])
#' }

I hope this helps. Otherwise, let me know and I can chime in the review of
your package

Best wishes
Kevin

On Mon, Nov 19, 2018 at 7:00 PM Shepherd, Lori <
Lori.Shepherd at roswellpark.org> wrote:

            

  
  
1 day later
#
Hi Lori and Kevin:

Thank you for your helpful responses! I was able to use "if
(interactive()) { ... }" format and return the appDir object for the
user. Thanks again!

Lindsay
On Mon, Nov 19, 2018 at 3:02 PM Kevin RUE <kevinrue67 at gmail.com> wrote:
#
Glad to be of help!

Nice package too! I managed to install it and give it a run!

Best wishes,
Kevin

On Wed, Nov 21, 2018 at 4:29 PM L Rutter <lindsayannerutter at gmail.com>
wrote: