I have a set of large dataframes that look like A and B:
A <- data.frame(A1=c(1,2,3,4,5),B1=c(6,7,8,9,10),C1=c(11,12,13,14,15 )) A1 B1 C1 1 1 6 11 2
Another alternative you can use mapply function
mapply
> mapply(function(x,y) cor(x,y),A,B) A1 B1 C1 0.9481224 0.9190183 0.4595880
Or just mapply(cor, A, B) as suggested by @Aaron.
mapply(cor, A, B)