Hi,
thanks so much:
pairs(sapply(MAR.omitindep[,c(poldis , polres , ecdis , culres , gcc1
)],jitter,amount=1), lower.panel=panel.smooth, upper.panel=panel.cor)
Mehmet.
On Mon, 25 Feb 2008 09:05:28 +0100
Petr PIKAL [EMAIL PROTECTED] wrote:
Hi
Add
sapply(any.data.frame, jitter)
into your function. Either sapply(na.omit(.), jitter) or
pairs(sapply(..., jitter), ...)
Regards
Petr
[EMAIL PROTECTED]
[EMAIL PROTECTED] napsal dne 25.02.2008 00:26:27:
Hi,
I am just starting to use R for a graduate course, and I like how
the correlation matrix at
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=137
I did something similar by copying from the examples(pairs), but it
seems that I need to jitter the bottom panel... and I have no idea
how to do that, and I mean no idea at all. I'd appreciate any
help...
Here are the graphs:
http://socy602.pbwiki.com/f/dep_correlationmatrix.jpeg
http://socy602.pbwiki.com/f/indep_correlationmatrix.jpeg
And this is the code I used to produce the graphs (not that I
understand it, but):
##
# Primary Component Analyses
##
##
# Dependent variables
##
# List of these variables:
# langfamr , ethdifxx , catness , gc7 , gc8r , gc12 , culdifxx ,
poldifxx , ecdifxx
##
# Look at correlation matrix for these
cor(MAR[,c(langfamr , ethdifxx , catness , gc7 , gc8r ,
gc12
,
culdifxx , poldifxx , ecdifxx )], use=complete.obs)
# Big time correlation matrix
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)
text(0.5, 0.5, txt, cex = cex * r)
}
MAR.omitdep - na.omit(MAR[,c(langfamr , ethdifxx , catness ,
gc7 ,
gc8r , gc12 , culdifxx , poldifxx , ecdifxx )])
pairs(MAR.omitdep[,c(langfamr , ethdifxx , catness , gc7 ,
gc8r ,
gc12 , culdifxx , poldifxx , ecdifxx )],
lower.panel=panel.smooth,
upper.panel=panel.cor)
# Save it
dev.copy(jpeg,filename=dep_correlationmatrix.jpeg,height=600,
width=800,bg=white)
dev.off()
##
# Independent variables
##
# List of variables
# poldis , polres , ecdis , culres , gcc1
##
# Look at the correlation matrix
cor(MAR[,c(poldis , polres , ecdis , culres , gcc1 )],
use=complete.obs)
# Big time correlation matrix
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)
text(0.5, 0.5, txt, cex = cex * r)
}
MAR.omitindep - na.omit(MAR[,c(poldis , polres , ecdis ,
culres
, gcc1 )])
pairs(MAR.omitindep[,c(poldis , polres , ecdis , culres ,
gcc1
)],
lower.panel=panel.smooth, upper.panel=panel.cor)
# Save it
dev.copy(jpeg,filename=indep_correlationmatrix.jpeg,height=600,
width=800,bg=white)
dev.off()
Thanks a lot in advance,
Sincerely,
Mehmet.
__
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.
__
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.