Bug 15458 - Incorrect labelling factor levels in plot.lm
Summary: Incorrect labelling factor levels in plot.lm
Alias: None
Product: R
Classification: Unclassified
Component: Graphics (show other bugs)
Version: R 3.0.1
Hardware: ix86 (32-bit) Windows 32-bit
: P5 normal
Assignee: R-core
Depends on:
Reported: 2013-09-17 03:43 UTC by martin.l.hazelton
Modified: 2013-09-26 16:07 UTC (History)
1 user (show)

See Also:

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

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)

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.