mardi 30 juin 2015

Multiple T-test in R

I have a 94 varibles(sample+proteins+group) and 172 observations in a matrix as:

Sample   Protein1   Protein2 ... Protein92 Group
1          1.53      3.325   ...   5.63      0
2          2.32      3.451   ...   6.32      0
.
. 
.
103        3.24      4.21    ...   3.53      0               
104        3.44      5.22    ...   6.78      1
.
.
.
192        6.75      4.34    ...   6.15      1

Something like this. Some of the sample are in group 0 and some are in group 1. I want to test if there is a differences between group 0 and 1 using a t-test and I want to do it for all the proteins. I was thinking of using an apply but have never used it so I am not sure how to use it. Also the names are not Protein1, protein2... , it is much longer so I would not want to have to write them all.

I also would only like the p-value for each protein in a matrix, something like this:

Protein  p-value
Protein1   0.00563
Protein2   0.0640
.
.
Protein92  0.610

Or something simular so that I after can find just the ones with a p-value lower than 0.05/92.

I hope I make sense, have never posted here before. Seems like an easy problem but couldn't find any help.

Aucun commentaire:

Enregistrer un commentaire