[R] pairs(X,Y) analog of cor(X,Y)?

2013-03-29 Thread Michael Friendly
With a data frame containing some X  Y variables I can get the between 
set correlations

with cor(X,Y):

 cor(NLSY[,1:2], NLSY[3:6])
  antisochyperact income  educ
math  0.043381307 -0.07581733 0.25487753 0.2876875
read -0.003735785 -0.07555683 0.09114299 0.1884101

Is there somewhere an analog of pairs(X,Y) that will produce the pairwise
plots of each X against each Y?
The formula method for pairs() is for a one-sided formula.  As a 
formula, I'm looking

for something like

pairs(math + read ~ antisoc +hyperact + income +  educ, data=NLSY)

lattice::xyplot has an extended formula interface, but interprets '+' to 
mean

superposition.

--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.  Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

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


Re: [R] pairs(X,Y) analog of cor(X,Y)?

2013-03-29 Thread Greg Snow
There is the pairs2 function in the TeachingDemos package that works like
cor(x,y) where you give it 2 matricies/data frames and it gives the
pairwise plots between the 2 groups.  There is currently not a formula
interface.


On Fri, Mar 29, 2013 at 12:16 PM, Michael Friendly frien...@yorku.cawrote:

 With a data frame containing some X  Y variables I can get the between
 set correlations
 with cor(X,Y):

  cor(NLSY[,1:2], NLSY[3:6])
   antisochyperact income  educ
 math  0.043381307 -0.07581733 0.25487753 0.2876875
 read -0.003735785 -0.07555683 0.09114299 0.1884101

 Is there somewhere an analog of pairs(X,Y) that will produce the pairwise
 plots of each X against each Y?
 The formula method for pairs() is for a one-sided formula.  As a formula,
 I'm looking
 for something like

 pairs(math + read ~ antisoc +hyperact + income +  educ, data=NLSY)

 lattice::xyplot has an extended formula interface, but interprets '+' to
 mean
 superposition.

 --
 Michael Friendly Email: friendly AT yorku DOT ca
 Professor, Psychology Dept.  Chair, Quantitative Methods
 York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
 4700 Keele StreetWeb:   http://www.datavis.ca
 Toronto, ONT  M3J 1P3 CANADA

 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

[[alternative HTML version deleted]]

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