I am wondering how I can get summary(object)
to work with a custom class in the package I create. For example, if you run the following:
testfunction <- function(x) { x.squared <- x^2 x.double <- 2*x x.triple <- 3*x result <- list(squared = x.squared, double = x.double, triple = x.triple) class(result) <- "customclass" result } x <- rnorm(100) output <- testfunction(x) summary(output)
you will see that the conclusion is completely useless. However, I cannot find how to manage this output. If someone could direct me to something, I would be grateful.
(I could, of course, create a custom summary function such as summary.Custom(object)
, but I would prefer the regular summary
method to work directly.
source share