Skip to content

Instantly share code, notes, and snippets.

View atlasbioinfo's full-sized avatar
:octocat:
Focusing

Haopeng Yu atlasbioinfo

:octocat:
Focusing
View GitHub Profile
@atlasbioinfo
atlasbioinfo / applyTheTtest.R
Created August 19, 2020 02:28
R语言批量t检验 t.test apply
> head(data,2)
A1 A2 A3 B1 B2 B3
TRINITY_DN100001_c0_g1 2.5 2.81 4.75 1.96 2.71 6.11
TRINITY_DN100002_c0_g1 0.0 0.00 0.00 0.00 0.00 40.45
> dim(data)
[1] 2000 6
pvalue=apply(data,1,function(x) t.test(x[1:3],x[4:6],paired = T)$p.value)