Environmental variable causes loop in pkgdown::build_suite()

126 Views Asked by At

This is a continuation from an earlier post (Include Shiny app in R package: Transfer an input parameter) that successfully resolved my question but that led to another problem.

Basically, I am running a Shiny app as part of an R package. To do this, I have an environmental variable PKGENVIR. As can be seen in the previous post, I accomplished this using:

### runExample.R

PKGENVIR <- new.env(parent=emptyenv()) # package level envir

#' @export
runExample <- function(data) {
  appDir <- system.file("shiny-examples", "myapp", package = "mypackage")
  if (appDir == "") {
    stop("Could not find example directory. Try re-installing `mypackage`.", call. = FALSE)
  }
  PKGENVIR$DATA <- data # put the data into envir
  shiny::runApp(appDir, display.mode = "normal")
} 

and in server.R:

### inside shiny app
data <- PACKAGE_NAME:::PKGENVIR$DATA ## read the data from envir

However, I am also trying to morph this into a pkgdown site. As a result, I run:

pkgdown::build_site()

However, this seems to create an infinite loop because the process freezes at the step:

Reading 'man/PKGENVIR.Rd' 

Any ideas on how to approach this issue would be very helpful. I had been running pkgdown::build_site() before this and had not had issues. Hence, I am almost certain it is due to this new environmental variable.

0

There are 0 best solutions below