Perhaps you can try: In two matrix 3 x 3(see 'dim' argument):
apply(array(data=c(mat1, mat2), dim=c(3,3,2)), 2, function(x)t.test(x[,1], x[,2])$p.value) On 19/11/2007, mogra <[EMAIL PROTECTED]> wrote: > > I have two matrix with same dimensions. I want to do t.test using each column > from 2 different matrix. > Column names in both matrix are same. > > e.g. > Matrix1 > id VC1 VC2 VC3 > R 1 2 3 > R1 4 5 6 > R3 7 8 9 > > > Matrix2 > id VC1 VC2 VC3 > R 10 11 12 > R1 13 14 15 > R3 16 17 18 > > want to do t.test > > for eg t.test(Matrix1$VC1, Matrix2$VC1)$p.value > > What is the best way to do it. I have dataset with 4000 columns for each > matrix with same row and column names. > > Thanks a lot. > -- > View this message in context: > http://www.nabble.com/using-two-different-matrix-%3A-how-to-do-t.test-tf4833943.html#a13829333 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.