R/showpspm.R

Defines functions showpspm

Documented in showpspm

#'
#' Shows the model definition file of one of the example models provided with PSPManalysis
#'
#' \code{showpspm} displays the file contents of one of the physiologically structured
#' population models that is provided as an example.
#'
#'   showpspm(modelname = NULL)
#'
#' @param  modelname  (string)
#' \preformatted{}
#'               Name of the example model to be displayed.
#'
#' @examples
#' \dontrun{
#' showpspm("Medfly.R")
#' }
#'
#' @export
showpspm <- function(modelname = NULL) {
  oldwd <- getwd()
  modeldir <- system.file("Models", package="PSPManalysis")
  setwd(modeldir)

  if ((!length(modelname)) || (!nchar(modelname)) || (!file.exists(modelname))) {
    cat("\nAvailable example models:\n\n")
    allmodels <- list.files(".", ".[hR]")
    cat(" ")
    cat(paste0(allmodels, sep="\n"))
    cat("\nYou have to specify one of the above model names\n\n")
  }
  else {
    file.show(modelname)
  }

  setwd(oldwd)
}

Try the PSPManalysis package in your browser

Any scripts or data that you put into this service are public.

PSPManalysis documentation built on Jan. 22, 2023, 1:10 a.m.