Suppose I have a list like this in R:
L <- list(
c(0.68, 0.78, 0.63, 0.2, 0.89, 0.81),
c(0.93, 0.89, 0.77, 0.86, 0.49, 0.2),
c(0.88, 0.08, 0.15, 0.35, 0.6, 0.45),
c(0.07, 0.85, 0.49, 0.92, 0.87, 0.34)
)
L
[[1]]
[1] 0.68 0.78 0.63 0.20 0.89 0.81
[[2]]
[1] 0.93 0.89 0.77 0.86 0.49 0.20
[[3]]
[1] 0.88 0.08 0.15 0.35 0.60 0.45
[[4]]
[1] 0.07 0.85 0.49 0.92 0.87 0.34
And I want to find the correlation coefficient between each pair of vectors but over multiple lengths, e.g, cor(L[[i]][1:t],L[[j]][1:t]) that t changes from 2 to 6. Is there any solution to perform it with the apply family function?