[R-pkg-devel] R CMD check halts on @example in shiny::runApp()

Hadley Wickham h@wickh@m @ending from gm@il@com
Tue Nov 20 00:17:53 CET 2018


On Mon, Nov 19, 2018 at 8:14 AM L Rutter <lindsayannerutter using gmail.com> wrote:
>
> Hello all:
>
> R CMD check does not complete for my package and halts at the line "*
> checking examples ..." I suspect the halting is due to @examples
> hanging in certain R/foo.R files, where shiny::runApp() is called for
> a shiny app located in a separate directory in this type of format:
>
> appDir <- system.file("shiny-examples", "plotLitreApp", package = "bigPint")
> shiny::runApp(appDir, display.mode = "normal")
>
> I suspect this is the problem because I previously had \dontrun{}
> around my @examples that used shiny apps and R CMD check worked fine.
> When I run the example code for these shiny apps directly into R, the
> shiny app works no problem. An example of one such R/foo.R file
> causing this hanging problem is located in the developing package at:
>
> https://github.com/lrutter/bigPint/blob/master/R/plotLitreApp.R
>
> Any advice on how to successfully use the @examples for this script
> and not halt R CMD check would be much appreciated!

One option is to use interactive:

if (interactive()) {
  runApp()
}

That way it won't run in R CMD check, but it will run from example()

Hadley

-- 
http://hadley.nz



More information about the R-package-devel mailing list