Skip to content
Prev 312015 / 398503 Next

printing difftime summary

the problem is that I cannot figure out which function prints this:
I added cat()s to print.summary.difftime and I do not see them, so it
appears that I have no direct control over how a summary.difftime is
printed as a part of a summary of a data.frame.


--8<---------------cut here---------------start------------->8---
summary.difftime <- function (v, ...) {
  s <- summary(as.numeric(v), ...)
  r <- as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
  names(r) <- c("string")
  r[[units(v)]] <- s
  class(r) <- c("summary.difftime","data.frame")
  invisible(r)
}
print.summary.difftime <- function (sd, ...) {
  cat("[[[print.summary.difftime]]]\n")
  print(list(...))
  print.data.frame(sd, ...)
}
--8<---------------cut here---------------end--------------->8---