-2

I'm trying to do a t.test for a lot of data sets and I want to them to be contained in a single ouput So far I'm doing a t.test similar to this

test1=t.test(dat$velocity,x[[1]][[2]])
test2=t.test(dat$velocity,x[[2]][[2]])
test3=t.test(dat$velocity,x[[3]][[2]])
4

1 に答える 1

0

Something like this should work:

tests <- lapply(1:length(x), function(i) t.test(dat$velocity,x[[i]][[2]]))

tests is a list list of the length length(x). You can access each t-test result with tests[[1]].

于 2013-03-27T06:33:06.583 に答える