[R] pairs

Greg Snow Greg.Snow at imail.org
Wed Oct 14 21:23:51 CEST 2009


Looking at the question again, I don't think pairs2 is the answer.  I think it will be easier to do this by hand than to get pairs to do it for you (though you could make your own function as a modification of pairs).

Does this do what you want?

xx <- matrix(scan(), ncol=3, byrow=TRUE)
0.30
0.43
3.88
0.38
0.59
3.53
0.30
0.42
2.12
0.33
0.53
2.12
0.30
0.47
3.76

yy <- matrix(scan(), ncol=3, byrow=TRUE)
0.32
0.47
5.18
0.23
0.26
1.06
0.42
0.65
3.88
0.28
0.38
3.76
0.35
0.47
1.41


par(mfrow=c(3,3), oma=c(4,4,4,4)+0.1, mar=c(0,0,0,0)+0.1)
for(i in 1:3) {
  for( j in 1:3 ) {
	if(i==j) plot(1,1, pch=as.character(i), ann=FALSE, axes=FALSE, cex=5)
	if(i < j ) plot( xx[,j], xx[,i], ann=FALSE, axes=FALSE  )
	if(i > j ) plot( yy[,j], yy[,i], ann=FALSE, axes=FALSE )
	box()
	if( i < j ){ axis(4, outer=TRUE); axis(3, outer=TRUE) }
	if( i > j ){ axis(1, outer=TRUE); axis(2, outer=TRUE) }
  }
}


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Greg Snow
> Sent: Wednesday, October 14, 2009 11:13 AM
> To: Seyit Ali Kayis; r-help at r-project.org
> Subject: Re: [R] pairs
> 
> Does the pairs2 function in the TeachingDemos package do what you want?
> 
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow at imail.org
> 801.408.8111
> 
> 
> > -----Original Message-----
> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> > project.org] On Behalf Of Seyit Ali Kayis
> > Sent: Wednesday, October 14, 2009 6:35 AM
> > To: r-help at r-project.org
> > Subject: [R] pairs
> >
> >
> > Dear all,
> >
> >
> >
> > I have two sets of data (say set1 and set2) as follow:
> >
> >
> >
> > set1
> >
> >
> >
> >
> >
> >
> >
> > x1
> > x2
> > x3
> >
> > 0.30
> > 0.43
> > 3.88
> >
> > 0.38
> > 0.59
> > 3.53
> >
> > 0.30
> > 0.42
> > 2.12
> >
> > 0.33
> > 0.53
> > 2.12
> >
> > 0.30
> > 0.47
> > 3.76
> >
> >
> >
> > set2
> >
> >
> >
> >
> >
> >
> >
> > y1
> > y2
> > y3
> >
> > 0.32
> > 0.47
> > 5.18
> >
> > 0.23
> > 0.26
> > 1.06
> >
> > 0.42
> > 0.65
> > 3.88
> >
> > 0.28
> > 0.38
> > 3.76
> >
> > 0.35
> > 0.47
> > 1.41
> >
> >
> >
> > The "pairs" function (such as pairs(~x1+x2+x3 data=set1, main="Simple
> > Scatterplot Matrix") ) is producing scatterplot matrix where lower
> and
> > upper diagonals have scatter plots of set1 variables.
> >
> >
> >
> > I want to produce a scatterplot matrix where in upper panel
> (diagonal)
> > I should have plots from set1 variables and in lower panel (diagonal)
> I
> > should have plots from set2 variables. Is there a way that I can do
> > this?
> >
> >
> >
> > Any help is deeply appreciated.
> >
> >
> >
> > Kind Regards
> >
> >
> >
> > Seyit Ali
> >
> >
> >
> > ---------------------------------------------------------------------
> --
> > -------------------------------------------
> > Dr. Seyit Ali KAYIS
> > Selcuk University
> > Faculty of Agriculture
> > Kampus, Konya, TURKEY
> >
> >             s_a_kayis at yahoo.com,    s_a_kayis at hotmail.com
> > Tell: +90 332 223 2830  Mobile: +90 535 587 1139  Fax: +90 332 241
> 0108
> >
> >                    Greetings from Konya, TURKEY
> >                 http://www.ziraat.selcuk.edu.tr/skayis/
> > ---------------------------------------------------------------------
> --
> > -----------------------------------------------
> >
> >
> >
> >
> >
> >
> >
> > _________________________________________________________________
> >
> >  Facebook.
> >
> > k-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-nz:SI_SB_2:092010
> > 	[[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at 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 at 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.




More information about the R-help mailing list