Re: [R] Paste expression in graph title

2010-01-25 Thread Paul Chatfield
.nabble.com] Sent: 25 January 2010 12:21 To: Paul Chatfield Subject: Re: [R] Paste expression in graph title Try this: plot(x, y, main = bquote(R^2 == .(round(summary(lm(y ~ x))$r.squared, 3 On Mon, Jan 25, 2010 at 10:06 AM, Paul Chatfield <[hidden email] <http://n4.nabble.co

Re: [R] Paste expression in graph title

2010-01-25 Thread Henrique Dallazuanna
Try this: plot(x, y, main = bquote(R^2 == .(round(summary(lm(y ~ x))$r.squared, 3 On Mon, Jan 25, 2010 at 10:06 AM, Paul Chatfield wrote: > > This was my initial attempt at creating a title on a graph of the R squared > value: > > x<-rnorm(10) > y<-rnorm(10) > plot(x,y, main=paste(expressio

Re: [R] Paste expression in graph title

2010-01-25 Thread Gabor Grothendieck
Try bquote: set.seed(123) x<-rnorm(10) y<-rnorm(10) R2 <- summary(lm(y ~ x))$r.squared R2round <- round(R2, digits = 3) plot(x, y, main = bquote(R^2 == .(R2round))) On Mon, Jan 25, 2010 at 7:06 AM, Paul Chatfield wrote: > > This was my initial attempt at creating a title on a graph of the R s

Re: [R] Paste expression in graph title

2010-01-25 Thread Dimitris Rizopoulos
Have a look at the help page for ?plotmath, and try also this: x <- rnorm(10) y <- rnorm(10) R2 <- round(summary(lm(y ~ x))$r.squared, 3) plot(x, y, main = bquote(R^2 == .(R2))) I hope it helps. Best, Dimitris Paul Chatfield wrote: This was my initial attempt at creating a title on a graph

[R] Paste expression in graph title

2010-01-25 Thread Paul Chatfield
This was my initial attempt at creating a title on a graph of the R squared value: x<-rnorm(10) y<-rnorm(10) plot(x,y, main=paste(expression(R^2)," = ",round(summary(lm(y~ x))$r.squared, digits=3), sep="")) I've read various other posts that say expression needs to be taken outside the paste, bu