[R] Legend

Filoche pmassicotte at hotmail.com
Thu Nov 24 14:18:23 CET 2011


Hi everyone.

I have a linear regression where I retrieve the R2 like this:

r2 = sprintf('%4.2f %s',(summary(reg1)$r.squared))

In my figure I have a legend where I would like to add that R2 value to the
legend text.

Something like: My text R^2 = r2

legend('topright', inset = .05, title='light ratios',  pch = c(21),
c(paste('Green/Red', R^2, '=', r2)), horiz=F,pt.bg =c('gray', 'black'), cex
= 0.75, bg = 'white')

But its not working.

Any help would be appreciated.

Regards,
Phil

--
View this message in context: http://r.789695.n4.nabble.com/Legend-tp4103799p4103799.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list