运行t.test时出错,数据本质上是恒定的

时间:2019-07-04 15:24:38

标签: r statistics

我有一个包含54675行和226列的数据框。在此数据帧中,前183(new_data [,1:183])列来自单个组,后43(new_data [,184:226])来自另一组。运行t.test

时出现此类错误
NoFailure=data[which(data$outcome==0),-1]
Failure=data[which(data$outcome==1),-1]

new_data=cbind(t(NoFailure),t(Failure))

p.vals = apply(new_data, 1, function(x) { t.test(x[1:183], x[184:226]) $p.value } )

NoFailure=data[which(data$outcome==0),-1]
Failure=data[which(data$outcome==1),-1]

new_data=cbind(t(NoFailure),t(Failure))

p.vals = apply(new_data, 1, function(x) { t.test(x[1:183], x[184:226]) $p.value } )

p.vals = apply(new_data, 1, function(x) { t.test(x[1:183], x[184:226]) $p.value } )
Error in t.test.default(x[1:183], x[184:226]) : 
  data are essentially constant
Called from: t.test.default(x[1:183], x[184:226])

0 个答案:

没有答案