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

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to