R/fetch.R

Defines functions fetch.sc_mplm fetch.sc_bplm fetch.sc_hplm fetch.sc_plm

#' Fetches elements from scan objects
#' Getter function for scan objects
#' @param object Object returned from a scan function.
#' @param what Element/part to be extracted.
#' @param ... Further parameters passed to the function.
#' @return An object of the respective regression model class.
#' @export
fetch <- function (object, what, ...) {
  UseMethod("fetch")
}

#' @export
fetch.sc_plm <- function(object, what = "model", ...) {
  if (what == "model") {
    return(object$full.model)
  }
}


#' @export
fetch.sc_hplm <- function(object, what = "model", ...) {
  if (what == "model") {
    return(object$hplm)
  }
  
}

#' @export
fetch.sc_bplm <- function(object, what = "model", ...) {
  if (what == "model") {
    return(object$mcmcglmm)
  }
}

#' @export
fetch.sc_mplm <- function(object, what = "model", ...) {
  if (what == "model") {
    return(object$full.model)
  }
}

Try the scan package in your browser

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

scan documentation built on April 3, 2025, 6:18 p.m.