Hi Stephen: If you want to take tem out of quotes, you can use deparse substitute as in below. Maybe there are other ways also but that's the one I often see used. I hope this email ends up looking okay because my mailer has been acting strangely lately.                                                                                                                                         Mark reg.line <- function(yin,xin, data) {
    yval <- deparse(substitute(yin))     xval <- deparse(substitute(xin))                         plot(data[,yval]~data[,xval], main=paste(xval,"vs.",yval, sep=" "), xlab=xval, ylab=yval, pch=20)     line <- lm(data[,yval]~data[,xval])     d <- summary(line)     mtext(3, line=1, adj=0.25 ,text=bquote(bold(R^2== ~ .(d$r.squared))), bty="n")     abline(line) }     x <- 1:100+rnorm(100) y <- 1:100 z <- data.frame(x,y) reg.line(y,x,data=z) On Apr 1, 2009, stephen sefick <ssef...@gmail.com> wrote: #excel like regression line but better reg.line <- function(y,x, data) {plot(data[,y]~data[,x], main=paste(x,"vs.",y, sep=" "), xlab=x, ylab=y, pch=20) line <- lm(data[,y]~data[,x]) d <- summary(line) mtext(3, line=1, adj=0.25 ,text=bquote(bold(R^2== ~ .(d$r.squared))), bty="n") abline(line)} x <- 1:100+rnorm(100) y <- 1:100 z <- data.frame(x,y) reg.line(y="y",x="x",data=z) try this - as an aside does anyone know how to take the x and y out of quotes. What can I do differently hope this helps Stephen Sefick On Wed, Apr 1, 2009 at 9:41 PM, Peter Alspach <[1]palsp...@hortresearch.co.nz> wrote: > Tena koe Sueli > > ?abline > ?text > > HTH ... > > Peter Alspach > >> -----Original Message----- >> From: [2]r-help-boun...@r-project.org >> [mailto:[3]r-help-boun...@r-project.org] On Behalf Of Sueli Rodrigues >> Sent: Thursday, 2 April 2009 2:35 p.m. >> To: [4]r-h...@r-project.org >> Subject: [R] Scatter plot >> >> >> Hi. How do I plot the straight line and r² in a scatter plot >> using a simple file x~y? >> >> Sueli Rodrigues >> >> Eng. Agrônoma - UNESP >> Mestranda - USP/ESALQ >> PPG-Solos e Nutrição de Plantas >> Fones (19)93442981 >>    (19)33719762 >> >> ______________________________________________ >> [5]r-h...@r-project.org mailing list >> [6]https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> [7]http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > The contents of this e-mail are confidential and may be subject to legal privilege. >  If you are not the intended recipient you must not use, disseminate, distribute or >  reproduce all or any part of this e-mail or attachments.  If you have received this >  e-mail in error, please notify the sender and delete all material pertaining to this >  e-mail.  Any opinion or views expressed in this e-mail are those of the individual >  sender and may not represent those of The New Zealand Institute for Plant and >  Food Research Limited. > > ______________________________________________ > [8]r-h...@r-project.org mailing list > [9]https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide [10]http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis ______________________________________________ [11]r-h...@r-project.org mailing list [12]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [13]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. References 1. mailto:palsp...@hortresearch.co.nz 2. mailto:r-help-boun...@r-project.org 3. mailto:r-help-boun...@r-project.org 4. mailto:r-help@r-project.org 5. mailto:R-help@r-project.org 6. https://stat.ethz.ch/mailman/listinfo/r-help 7. http://www.R-project.org/posting-guide.html 8. mailto:R-help@r-project.org 9. https://stat.ethz.ch/mailman/listinfo/r-help 10. http://www.R-project.org/posting-guide.html 11. mailto:R-help@r-project.org 12. https://stat.ethz.ch/mailman/listinfo/r-help 13. http://www.R-project.org/posting-guide.html ______________________________________________ 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.