I have a dataframe with 49 variables and 4M rows. I want to calculate the correlation matrix of 49 x 49. All columns are of class numeric.
Here's a sample :
df <- data.frame(replicate(49,sample(0:50,4000000,rep=TRUE))) I used the standard cor function.
cor_matrix <- cor(df, use = "pairwise.complete.obs") This is taking a really long time. I have 16GB RAM and an i5 single core 2.60Ghz.
Is there a way to make this calculation faster on my desktop?
use = "pairwise.complete.obs". On my system (tested with 12 columns) that takes five times as long asuse = "everything".