Skip to content

plot.lm mislabels points with na.exclude (PR#3750)

1 message · Martin Maechler

#
>> From: maechler@stat.math.ethz.ch [mailto:maechler@stat.math.ethz.ch] 
    >> 
    >> >>>>> "AndyL" == andy liaw <andy_liaw@merck.com>
    >> >>>>>     on Fri, 15 Aug 2003 04:08:59 +0200 (MET DST) writes:
    >> 
    AndyL> Here's one possible fix (may not be very efficient).
    AndyL> Change lines 82-83 in $R_HOME/src/base/R/plot.lm.R 
    >> to the following:
    >> 
    AndyL> if (id.n > 0) {
    AndyL> qqx <- rep(NA, n)
    AndyL> qqy <- rep(NA, n)
    AndyL> qqx[!is.na(rs)] <- qq$x
    AndyL> qqy[!is.na(rs)] <- qq$y
    AndyL> text.id(qqx[show.rs], qqy[show.rs], show.rs, adj.x = TRUE)
    AndyL> }
    >> 
    >> Thank you, Andy.
    >> 
    >> I digged a bit further, however.
    >> I'd argue the bug is in  qqnorm(): It shouldn't drop NA's in 
    >> its result, list(x= ., y=.).
    >> 
    >> R-devel will contain a fixed  qqnorm.default() function
    >> which will also solve this plot.lm() behavior.

    AndyL> I completely agree.  ?qqnorm does not say what it
    AndyL> does with NAs.  Maybe it should?

It now does (in R-devel) :
Regards,
Martin