Bug 15458 - Incorrect labelling factor levels in plot.lm
Incorrect labelling factor levels in plot.lm
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Graphics
R 3.0.1
ix86 (32-bit) Windows 32-bit
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-17 03:43 UTC by martin.l.hazelton
Modified: 2013-09-26 16:07 UTC (History)
1 user (show)

See Also:


Attachments
Example test dataset (498 bytes, text/plain)
2013-09-17 03:44 UTC, martin.l.hazelton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description martin.l.hazelton 2013-09-17 03:43:39 UTC
The function plot.lm appears to incorrectly label factor levels in the "Constant Leverage: Residuals vs Factor Levels" plot.

Example (using attached data)

river <- read.table(file="river.txt",header=T)
river.lm <- lm(Aldrin ~ Depth, data=river)
par(mfrow=c(2,2))
plot(river.lm)

The labels for "Surface" and "Bottom" are reversed.
Comment 1 martin.l.hazelton 2013-09-17 03:44:42 UTC
Created attachment 1485 [details]
Example test dataset
Comment 2 Duncan Murdoch 2013-09-25 02:17:42 UTC
This is another manifestation of bug 14837.  In that case, I thought that the solution was to undo the sorting, but was convinced not to do that.  That solution also works here...
Comment 3 Duncan Murdoch 2013-09-26 16:07:28 UTC
Fixed in R-devel and R-patched as of r63999.