On 3/20/07, Nguyen Dinh Nguyen <[EMAIL PROTECTED]> wrote:
> Dear R helpers,
>
> I would like to have abline,  for a lm model for
> example, lying within data range. Do you know how to
> get it?
>
> Thank in advance
>
> Nguyen D Nguyen
>
> #CODE
> x<- rnorm(200, 35,5)
>  y<- rnorm(200, 0.87,0.12)
>  plot(y~x, xlim=c(0,50), pch=17, bty="l")
>  abline(lm(y~x))

This is really easy with ggplot:

install.packages("ggplot")
library(ggplot)
qplot(x,y, type=c("point","smooth"), method=lm)

or, if you don't want the standard errors
qplot(x,y, type=c("point","smooth"), method=lm, se=F)

Hadley

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to