Skip to content
Back to formatted view

Raw Message

Message-ID: <9bf55c3.1013.1480febec6e.Coremail.my1stbox@163.com>
Date: 2014-08-26T01:26:10Z
From: my1stbox
Subject: How to do t.test to rows of a dataframe using apply family function?

Hi All?
How to do t.test  to rows (with two levels, or in other words, groups of samples) of a dataframe using apply family function? I have done that using function and loops. And my overall purpose is to calculate DE genes from two groups of miRNA microarray samples. And I know limma can do that, but it seems limma doesn't support paired t-test.

t.test.df=function(df,paired){
  df.t=c()
  for(i in 1:nrow(df)){
    df.t=rbind(df.t,unlist(t.test(df[i,grp1],df[i,grp2],paired=paired)))
  }
  rownames(df.t)=rownames(df)
  df.t
}

Bests!
Allen Chiu

2014-08-26
	[[alternative HTML version deleted]]