R/show_methods.R

#' Generic show method for distribution objects
#'
#' The distribution objects have an internal structure that is used for caching purposes.
#' Using the default `show` method gives the illusion of duplicate values.
#' This show method aims to avoid this confusion.
#' @param object A distribution object.
#' @importFrom methods show
#' @export
setMethod("show",
          signature = signature(object = "distribution"),
          definition = function(object) {
            msg = paste("Reference class object of class", methods::classLabel(class(object)), "\n")
            cat(msg)
            cat('Field "xmin": \n')
            print(object$getXmin())
            cat('Field "pars": \n')
            print(object$getPars())
            cat('Field "no_pars": \n')
            print(object$no_pars)
          }
)
csgillespie/poweRlaw documentation built on Feb. 5, 2025, 5:13 a.m.