我的数据设置如下:
type age rust
0 1 29.00
0 0 95.00
.....
1 1800 7.56
我想根据类型0和1创建锈蚀与年龄的散点图。我还想将红色的最小二乘回归线覆盖为0型,蓝色覆盖1型。
我尝试了以下操作,但是当我尝试覆盖abline命令时,它远离图表:
library(lattice)
xyplot(rust$rust~rust$age, group = rust$type, main = "Scatterplot of Rust vs. Age by Type")
abline(rust$rust~rust$age, col = "blue")