[R] how to use apply on a two variable t-test

Jason Dunsmore jbdunsmo at utmb.edu
Wed Dec 31 16:12:41 CET 2003


does anyone know how to use the apply function on a two-variable t-test? 
i've tried everything.

apply(data[1:4],1,t.test) # works, but only a one-variable test
apply((data[1:4],data[5:9]),1,t.test) # returns a syntax error

i've also tried using the for loop:

for (i in 1:1000) t.test(data[i,1:4],data[i,5:9])

doesn't print anything!  it processes for awhile, so i know it's doing 
the calculations.

t.test(data[1,1:4],data[1,5:9])

works fine! prints to the screen as i'd expect.

i have checked and double checked that sink() is empty.  please also 
send your reply to jbdunsmo at utmb.edu.  i receive the digest version of 
the mailing list.

thanks for any help,
jason




More information about the R-help mailing list