0

My data has repeats in columns for two variables BFP and DAP. There are 10 rows of these - with each row named after a gene. I am trying to compare the means of AFP and APP for each gene via a two-sample t-test with unequal variances, and assign the name to each output p-value. The current code stores 10 of the same t-test output.

pvalue <- vector(mode = "list", nrow(dataframe))
for (i in seq(nrow(dataframe))){
  pvalue[[i]]<-t.test(df.BFP, df.DAP)
}

How do I get it to iterate through doing a t-test for each row, and then assign that to the row name? The dataframse looks like this:

                 BFP      BFP     BFP    DAP     DAP      DAP  
CTFP synthase  -0.4787 -0.3728 -0.7448 -1.3823 -0.9742 -0.8923
cathepsin       1.8874  1.5847  2.1324  2.3847  2.1883  1.9283
pusine          0.9348  0.8573  0.7376  0.9273  1.0283  1.0283
DPSH synthase  -0.9123 -0.8172  2.1234 -0.2736 -0.9273 -0.3726

This is a summary of a lot more columns (38) and rows.

  • did you try `?mapply`? – C8H10N4O2 May 15 '17 at 16:23
  • Yeah I did, couldn't get that to work. – Helpful_Triazole May 16 '17 at 13:12
  • please provide sample data. See [here](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for how to make a great reproducible example. Your question is fairly basic, but without a more precise understanding of your data structure than what you've provided, nobody will be able to help you. – C8H10N4O2 May 16 '17 at 14:14

0 Answers0