This is the same malformatted message you posted on R-SIG-Mac even after David specifically asked for clarification.... not to reward bad behavior, but perhaps this will enlighten:
# Minimal reproducible data! x <- runif(15, 0, 5) y <- 3*x - 2 + runif(15) dat <- data.frame(x = x, y = y) rm(list = c("x", "y")) # Base graphics plot using the formula interface plot(y ~ x, data = dat) abline(lm(y~x, data = dat), col = "red3", lwd = 2) Alternatively library(ggplot2) ggplot(dat, aes(x = x, y = y)) + geom_point() + stat_smooth(method = "lm", color = I("red3")) which is perhaps overkill in this situation. Michael On Tue, Apr 10, 2012 at 11:03 PM, Tawee Laoitichote <ohowow2...@hotmail.com> wrote: > > > > > hi, I'm doing some data on least square curve fitting. What I like to have > is to compare the scatter plot whilst having the fitting curve on the same > coordinates. Any suggestting command besides plot(x,y). TaweeMac OSX 10.7.3 > [[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. ______________________________________________ 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.