Displaying 1 result from an estimated 1 matches for "tp3215455p3216099".
2011 Jan 13
6
add a linear regression line to the plot
Dear R users,
I am a new R user. My problem is very simple: I want to add a linear regression line to the plot(type="p"), codes are as below:
x<-c(10,20,40,80)
y<-c(30,40,100,200)
plot(x,y,type="p")
lines(lm(x~y),col="red",lwd=1.5)
I got only plot without linear line.
Many thanks ahead for your advice!
Xipei Wang
[[alternative HTML version deleted]]