R/plot.survRes.R

Defines functions plot.survRes

Documented in plot.survRes

## legacy code removed in surveillance 1.20.0
## now plotting via stsplot_time()
plot.survRes <- function(x, method = x$control$name, disease = x$control$data,
                         xaxis.years = TRUE, startyear = 2001, firstweek = 1,
                         same.scale = TRUE, ...,
                         main = paste0("Analysis of ", disease, " using ", method))
{
  stopifnot(is.vector(x$control$range, mode = "numeric"))
  stsObjRange <- disProg2sts(x[["disProgObj"]])[x$control$range,]
  stsObjRange@alarm[] <- x[["alarm"]]
  stsObjRange@upperbound[] <- x[["upperbound"]]

  if (length(ignored <- c("startyear", "firstweek")[c(!missing(startyear), !missing(firstweek))]))
    warning("ignored legacy argument(s): ", paste0(ignored, collapse = ", "))

  ## see plot(sts.cdc) in vignette("surveillance") or demo("cost")
  hookFunc <- if (is.null(x$aggr)) function() NULL else {
    stsObjRange@control$aggr <- x$aggr
    upperboundx <- NULL  # make codetools::checkUsage() happy
    function() points(upperboundx, x@control$aggr)
  }

  if (xaxis.years) {
      stsplot_time(stsObjRange, same.scale = same.scale, ..., main = main,
                   hookFunc = hookFunc)
  } else {
      stsplot_time(stsObjRange, same.scale = same.scale, ..., main = main,
                   hookFunc = hookFunc, xaxis.labelFormat = NULL)
  }
}

Try the surveillance package in your browser

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

surveillance documentation built on July 20, 2022, 1:06 a.m.