[Rd] could we add an argument to suppress printing of levels for print.factor()?

A.J. Rossini rossini@u.washington.edu
19 Jun 2002 09:15:28 -0700

>>>>> "a" == A J Rossini <rossini@blindglobe.net> writes:

>>>>> "martin" == Martin Maechler <maechler@stat.math.ethz.ch> writes:
    martin> Hence we are waiting for a new patch  (:-)

    a> In order to do that, I need to know what abbreviate.arg (the
    a> "un-documented" argument) does.  Anyone know?    Other thant that,
    a> it (the patch) is almost ready.

    a> (yes, I'm silly -- I'd rather not fire up S-PLUS 6 when doing reverse
    a> engineering...). 

And here's the hack; note that I've left my "argument" in for
backwards compatibility.

"print.factor" <- 
  function (x, quote = FALSE, max.levels=5, print.levels = {if
(max.levels==0) FALSE else TRUE}, ...)
  if (length(x) <= 0) 
  else print(as.character(x), quote = quote, ...) 
  if (print.levels) {
    cat("Levels: ", paste(levels(x)[1:max.levels], collapse = " "),

It's ugly but seems to work.


A.J. Rossini				Rsrch. Asst. Prof. of Biostatistics
U. of Washington Biostatistics		rossini@u.washington.edu	
FHCRC/SCHARP/HIV Vaccine Trials Net	rossini@scharp.org
-------------- http://software.biostat.washington.edu/ ----------------
FHCRC: M: 206-667-7025 (fax=4812)|Voicemail is pretty sketchy/use Email
UW:   Th: 206-543-1044 (fax=3286)|Change last 4 digits of phone to FAX
(my tuesday/wednesday/friday locations are completely unpredictable.)

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch