Created
February 2, 2012 17:06
-
-
Save ohofmann/1724594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot correlation score in pairs() panel | |
panel.cor <- function(x, y, digits=2, prefix="", cex.cor) | |
{ | |
usr <- par("usr"); on.exit(par(usr)) | |
par(usr = c(0, 1, 0, 1)) | |
r = (cor(x, y, use="pairwise")) | |
txt <- format(c(r, 0.123456789), digits=digits)[1] | |
txt <- paste(prefix, txt, sep="") | |
if(missing(cex.cor)) cex <- 0.6/strwidth(txt) | |
text(0.5, 0.5, txt, cex=cex ) | |
} | |
# Standard pairs using smoothed plots for large number of data points | |
pairs(data, | |
upper.panel=function(...) smoothScatter(..., nrpoints=0, add=TRUE), | |
lower.panel=panel.cor | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment