[R] Multiple t.test
C.H.
chainsawtiney at gmail.com
Mon Sep 12 09:54:10 CEST 2011
Dear R experts,
Suppose I have an data frame likes this:
> example <- data.frame(age=c(1,2,3, 4,5,6), height=c(100,110,120,130,140,150), disease=c(TRUE, TRUE, TRUE, FALSE, FALSE, FALSE))
> example
age height disease
1 1 100 TRUE
2 2 110 TRUE
3 3 120 TRUE
4 4 130 FALSE
5 5 140 FALSE
6 6 150 FALSE
Is there anyway to compare the age and height between those with
disease=TRUE and disease=FALSE using t.test and extract the p-values
quickly?
I can do this individually
t.test(example$age~example$disease)[3]
But when the number of variable grow to something like 200 it is not
easy any more.
Thanks!
Regards,
CH
--
CH Chan
More information about the R-help
mailing list