[R] t.tests by unique groupes

Imri bisrael at agri.huji.ac.il
Mon Jun 1 10:03:00 CEST 2009


Thanks for the answer, but it's still don't work.

What I get for each genotype look like this:

$`02-02`

        Welch Two Sample t-test

data:  slength[, 6] by slength[, 3] 
t = 1.6262, df = 682.116, p-value = 0.1044
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval:
 -0.1336494  1.4224993 
sample estimates:
mean in group d mean in group w 
       2.419450        1.775025 

 For each of the  genotypes all the data is tests, not just the data for the
unique genotype.

 

Peter Dalgaard wrote:
> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/t.tests-by-unique-groupes-tp23810917p23811273.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list