For your main question, see ?mapply. For the "what happened to the output in my for loop" FAQ: you need to put in an explicit print() around the t.test call. At the command prompt, expressions are evaluated and printed; elsewhere they are only evaluated.
HTH and Happy New Year to all, Simon > -----Original Message----- > From: Jason Dunsmore [mailto:[EMAIL PROTECTED] > Sent: 31 December 2003 15:13 > To: [EMAIL PROTECTED] > Subject: [R] how to use apply on a two variable t-test > > > Security Warning: > If you are not sure an attachment is safe to open please contact > Andy on x234. There are 0 attachments with this message. > ________________________________________________________________ > > 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 [EMAIL PROTECTED] i receive the digest > version of > the mailing list. > > thanks for any help, > jason > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 644449 Fax: +44 (0) 1379 644445 email: [EMAIL PROTECTED] web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}} ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help