Skip to content

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

1 message · A.J. Rossini

#
could we add an argument to suppress printing of levels for
print.factor()?  i.e.:

 
print.factor <-
function (x, quote = FALSE, print.levels = TRUE, ...)           ## MODIFIED
{
    if (length(x) <= 0) 
        cat("factor(0)\n")
    else print(as.character(x), quote = quote, ...)
    if (print.levels) {                                         ## ADDED
        cat("Levels: ", paste(levels(x), collapse = " "), "\n")
    }                                                           ## ADDED  
    invisible(x)
}

I've done this for my local work, but wondering if this is useful in
general?

best,
-tony