I need to create a "decent" correlation matrix; the output of the R is really ugly and not easy to follow
What are my choices? How can I export the output into a simple table?
Also, I found on the net this beautiful correlation matrix at http://addictedtor.free.fr/graphiques/graphcode.php?graph=137 :tup:
But I cannot understand the code, what to change what not to change and why... any manual of biginners? I downloaded some but ...
What are my choices? How can I export the output into a simple table?
Also, I found on the net this beautiful correlation matrix at http://addictedtor.free.fr/graphiques/graphcode.php?graph=137 :tup:
But I cannot understand the code, what to change what not to change and why... any manual of biginners? I downloaded some but ...
Code:
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 <- abs(cor(x, y))
txt <- format(c(r, 0.123456789), digits=digits)[1]
txt <- paste(prefix, txt, sep="")
if(missing(cex.cor)) cex <- 0.8/strwidth(txt)
test <- cor.test(x,y)
# borrowed from printCoefmat
Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
symbols = c("***", "**", "*", ".", " "))
text(0.5, 0.5, txt, cex = cex * r)
text(.8, .8, Signif, cex=cex, col=2)
}
pairs(USJudgeRatings[,c(2:3,6,1,7)],
lower.panel=panel.smooth, upper.panel=panel.cor)