apply 技巧

在分析大规模数据时使用apply往往比for循环快,但是,很难知道apply到底需要多长时间才能够把数据跑完。办法很简单:

apply(matrix,1,function(x){
TT = t.test(x)
print(which(matrix [,1] == x[1])
return(TT$p.value)
})

这里面,加一句print语句即可!

posted on 2013-03-08 07:20  Forever_YCC  阅读(159)  评论(0编辑  收藏  举报

导航