[Rd] plot.lm mislabels points with na.exclude (PR#3750)
maechler at stat.math.ethz.ch
maechler at stat.math.ethz.ch
Fri Aug 15 17:21:20 MEST 2003
>>>>> "AndyL" == andy liaw <andy_liaw at merck.com>
>>>>> on Fri, 15 Aug 2003 16:11:18 +0200 (MET DST) writes:
>> From: maechler at stat.math.ethz.ch [mailto:maechler at stat.math.ethz.ch]
>>
>> >>>>> "AndyL" == andy liaw <andy_liaw at 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) :
>> Value:
>>
>> For 'qqnorm' and 'qqplot', a list with components
>>
>> x: The x coordinates of the points that were/would be plotted
>>
>> y: The original 'y' vector, i.e., the corresponding y
>> coordinates _including 'NA's_.
Regards,
Martin
More information about the R-devel
mailing list