Skip to content
Prev 314816 / 398506 Next

plot xaxp issue

Hello,

Thanks again.
But something wrong with the subset after lm
boy<-read.csv("H:/boy_data.csv",header=T)
girl<-read.csv("H:/girl_data.csv",header=T)
together <- rbind(boy, girl)
together$sex <- factor(rep(c("boy", "girl"), c(8,7)))
plot(together$body_length, together$body_weight, ....,
col=c("firebrick3","saddlebrown")[as.numeric(together$sex)], ....)

boyline<-lm(body_weight ~ body_length, data=together, subset(sex=="boy"))
I updated it aas
But an error showed, saying:
error in xj[i] : useless type of  'list'

Please kindly help and thanks again.
BTW, the code below might need update as well.
Elaine
The original code with advice by Petr
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
boy<-read.csv("H:/boy_data.csv",header=T)
girl<-read.csv("H:/girl_data.csv",header=T)
together <- rbind(boy, girl)
together$sex <- factor(rep(c("boy", "girl"), c(8,7)))
plot(together$body_length, together$body_weight, ....,
col=c("firebrick3","saddlebrown")[as.numeric(together$sex)], ....)

boyline<-lm(body_weight ~ body_length, data=together, subset(sex=="boy"))
abline(boyline,col="firebrick3",lwd=2)