[R] Using apply for two datasets

2009-01-08 Thread Christos Argyropoulos
It depends on how the data are arranged ## x-matrix(c(1,2,3,2,8,2,4,5,6),nrow=3) y-matrix(c(10,2,13,0,8,4,4.2,5.2,6.2),nrow=3) q-mapply(t.test,as.data.frame(x),as.data.frame(y)) q ## The ith column of q contain the results of applying t.test

[R] Using apply for two datasets

2009-01-06 Thread Gang Chen
I can run one-sample t-test on an array, for example a matrix myData1, with the following apply(myData1, 2, t.test) Is there a similar fashion using apply() or something else to run 2-sample t-test with datasets from two groups, myData1 and myData2, without looping? TIA, Gang

Re: [R] Using apply for two datasets

2009-01-06 Thread Henrique Dallazuanna
I think that you can use mapply for this. On Tue, Jan 6, 2009 at 3:24 PM, Gang Chen gangch...@gmail.com wrote: I can run one-sample t-test on an array, for example a matrix myData1, with the following apply(myData1, 2, t.test) Is there a similar fashion using apply() or something else to

Re: [R] Using apply for two datasets

2009-01-06 Thread Jorge Ivan Velez
Hi Gang, Perhaps this post might be useful in this case. Please take a special lookat Gábor Csárdi's reply. http://www.nabble.com/apply,-t-test-and-p-values-to20012292.html#a20012292 HTH, Jorge On Tue, Jan 6, 2009 at 1:10 PM, Gang Chen gangch...@gmail.com wrote: Thanks a lot for the quick

Re: [R] Using apply for two datasets

2009-01-06 Thread Satoshi Takahama
To: Henrique Dallazuanna www...@gmail.com Cc: r-h...@stat.math.ethz.ch Sent: Tuesday, January 6, 2009 10:10:44 AM Subject: Re: [R] Using apply for two datasets Thanks a lot for the quick help! mapply() seems promising. However, mapply(t.test, myData1, myData2) would not work, so how can I specify

Re: [R] Using apply for two datasets

2009-01-06 Thread Gang Chen
Subject: Re: [R] Using apply for two datasets Thanks a lot for the quick help! mapply() seems promising. However, mapply(t.test, myData1, myData2) would not work, so how can I specify the margin in mapply() which function t.test() will be applied over? For example, I specify the 2nd dimension