[R] Multiple output from cor.test
Joseph Wakeling
joseph.wakeling at webdrake.net
Tue Apr 10 12:20:08 CEST 2007
Hello all,
I'm trying to use cor.test across a range of values via the apply command,
c <- apply(X,1,cor.test,y)
where X is an array, giving me multiple output from cor.test. I can
access individual elements of this by e.g. c[[1]] or c[[1]]$estimate or
c[[n]] or whatever, but is there a way to get out the vector of all
estimates, or all p-values?
i.e. if I want to get out a vector p which is in effect,
p <- c(c[[1]]$p.value, c[[2]]$p.value, ..... )
can I do this without doing a for loop?
I note that I can't do something like c[[1:n]]$p.value, for example.
I have to say I don't understand the notation c[[n]] to get the n'th
estimate so if anyone could explain it I would be very happy.
Many thanks,
-- Joe
More information about the R-help
mailing list