RE: [R] pairewise plots

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Wed 30 Mar 2005 - 01:17:02 EST


Something like this should do it:

invisible(lapply(seq(1, length(dat), by=2),

                 function(i) plot(dat[[i]]+dat[[i+1]], dat[[i]] -
dat[[i+1]])))

Andy

> From: Hai Lin
>
> Dear R users,
>
> I have a data generated as the following,
>
> dat <- data.frame(matrix(sample(24), nrow=4))
> dimnames(dat) <-list(rownames=c('g1','g2','g3','g4'),
> colnames=c("A_CH1","A_CH2","B_CH1","B_CH2","C_CH3","C_CH3"))
>
> > dat
> A_CH1 A_CH2 B_CH1 B_CH2 C_CH3 C_CH3
> g1 16 24 7 9 14 20
> g2 4 10 19 22 5 17
> g3 11 18 21 12 13 1
> g4 2 3 15 6 23 8
>
> I am trying to plot them pairwise by column(might extend to
> more than 3 pairs)
> Instead manually plotting as below, could you please point me
> out with easier ways?
>
> par(mfrow=c(3,1))
> plot(dat$A_CH1+dat$A_CH2, dat$A_CH1-dat$A_CH2)
> plot(dat$B_CH1+dat$B_CH2, dat$B_CH1-dat$B_CH2)
> plot(dat[,5]+dat[,6], dat[,5]-dat[,6])
>
> Thanks a lot for your help
>
> __________________________________________________
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Mar 30 01:31:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:56 EST