I have a list that contains outputs from multiple correlation tests
dput(head(corr[1:2]))
list(structure(list(statistic = c(S = 1486), parameter = NULL,
p.value = 0.219369570345178, estimate = c(rho = 0.265810276679842),
null.value = c(rho = 0), alternative = "two.sided", method = "Spearman's rank correlation rho",
data.name = "x$theta.x and x$theta.y"), class = "htest"),
structure(list(statistic = c(S = 1852), parameter = NULL,
p.value = 0.699151237307271, estimate = c(rho = 0.0849802371541502),
null.value = c(rho = 0), alternative = "two.sided", method = "Spearman's rank correlation rho",
data.name = "x$theta.x and x$theta.y"), class = "htest"))
I would like to extract into a separate data frame p.value and estimate. For each element I can do it like this:
corr[[1]][3]
$p.value
[1] 0.2193696
> corr[[1]][4]
$estimate
rho
0.2658103
But I did not have any success in trying to extract those values from the entire list at once.