Hi, > lines(lm(x~y),col="red",lwd=1.5) should be abline(lm(y~x),col="red",lwd=1.5)
hth. Am 13.01.2011 09:35, schrieb wangxipei: > > 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 > E-mail:wangxi...@gmail.com > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Eik Vettorazzi Department of Medical Biometry and Epidemiology University Medical Center Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/7410-58243 F ++49/40/7410-57790 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.