On Wed, 20 Sep 2000, Ren Yu wrote:
>
> Hi all,
>
> I want to perform a 2-sample t-test for each row(m_i) of a dataframe(m x
> (n1+n2)). Is there a quick way without having loop to do it ? Since my data
> set usually has thousands of rows. Thanks in advance!
Well, apply(A, 2, function(x) t.test(x[1:n1], x[(n1+1):n2])$p.value) avoids
the loop, but why do you want to do this? I would apply this to blocks of
say, 100 or 1000 rows at a time. if a loop is really a problem.
Also, why do you want to 1000s of t-tests? Multiple comparisons raise
their ugly heads here.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|