Hi all,

I noticed that DataFrame objects have a much faster and more practical printing format than base R's data.frame class. So I wrote a replacement for "print.data.frame" that prints data.frames in the same style as DataFrames. Just stick it in your ~/.Rprofile and your data.frames will magically print like DataFrames.

print.data.frame <- function(df) {
  if (require("IRanges")) {
    prev.max.print <- getOption("max.print")
    on.exit(options(max.print=prev.max.print))
    options(max.print=ncol(df) * 20)
    x <- capture.output(print(as(df, "DataFrame")))
    cat(str_replace(x[[1]], "DataFrame", "data.frame"),
        x[-1],
        sep="\n")
  } else {
    base::print.data.frame(df)
  }
}

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to