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. ______________________________________________ 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.