[R] t.tests by unique groupes
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Mon Jun 1 09:29:30 CEST 2009
Imri wrote:
> My data (slength) look like this:
> Plant Block Treat Genotype Source MPH
> 1 1 1 w 05-AZM sp 160 NA
> 2 2 1 w 12-50 463 NA
> 3 3 1 w 12-51 sp 150 0.0508982
> 4 5 1 w 29-42 567 0.9017094
> 5 6 1 w KNG-KNG 811 NA
> 6 7 1 w 02-02 1 NA
>
> Treat column has w or d for each Plant(row). I wont to do t.test of
> MPH~Treat for each of the genotypes (128 total). I tried :
>
> t.tests<-by(slength, slength[,4], function(x)
> t.test(slength[,6]~slength[,3]))
>
> but it is not what I need.
> Do you have any ideas?
> Thanks
> Imri
>
Your function(x)... doesn't depend on x! Try
...t.test(MPH~Treat, data=x)
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list