I have a dataframe like df, with a dimension of 10,000 x 40,000 (this matrix has a lot of 0's):
value1 <- c(1, 0, 3, 0, 0, 2)
value2 <- c(0.8, 0.1, 9, 0, 0, 5)
value3 <- c(8, 3, 0, 0, 0, 0)
df <- data_frame(value1, value2, value3)
I want to calculate the covariance matrix of df.
I have tried to use bigcor()
and I have also tried to calculate the covariance matrix of a sparse matrix (Running cor() (or any variant) over a sparse matrix in R).
However, R session aborts.
Any help?