R/print.mcgf.R

Defines functions print.mcgf

Documented in print.mcgf

#' Print an `mcgf` object.
#'
#' @param x An `mcgf` object.
#' @param attr Attribute to be printed.
#' @param ... Optional arguments to print methods.
#'
#' @return No return value, called for side effects.
#'
#' @export
#' @examples
#' data(sim1)
#' sim1_mcgf <- mcgf(sim1$data, dists = sim1$dists)
#' print(sim1_mcgf, "dists")
print.mcgf <- function(x, attr = ".Data", ...) {
    if (attr == ".Data") {
        print.data.frame(x, ...)
        cat(
            "\nOther attributes:",
            paste(names(attributes(x))[-c(1:3)], collapse = ", "),
            "\n"
        )
        return(invisible(NULL))
    } else {
        print(attr(x, attr, exact = TRUE))
        return(invisible(NULL))
    }
}

Try the mcgf package in your browser

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

mcgf documentation built on June 29, 2024, 9:09 a.m.