Rolf Turner wrote:

Paul E. Johnson wrote:


I handed out some results from glm() and the students ask "how many observations were dropped due to missing values"?

How would I know?
...
 It
would be ***VERY*** easy to write a wrapper for glm() to include
the number of dropped observations if you want to include that
information in a ``printout''.

To wit


naPrint <- function(model,...) {
    if(!inherits(model,"lm") || !inherits(model,"glm"))
        stop("no support for class ",class(model),"\n")
    if(!is.null(model$na.action)) {
        action <- paste("na.action:",attr(model$na.action,"class"))
        rows <- as.numeric(model$na.action)
        list(action=action,rows=rows)
    } else { #no missing values
        list(action=options()$na.action, rows=NULL)
    }
}

Building this as a generic function and its methods is left as an exercise ;) So is a a prettier print method, and possibly a method for latex() or xtable().

Cheers

Jason
--
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
[EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to