I have some problems with the vegdist
function. I want to calculate a distance matrix with jaccard. I have binary data.
The problem is that i have a matrix of 138037 rows (sites) and 89 columns (species). my script is:
library("vegan")
memory.limit(size = 100000) # it gives 1 Tera from HDD in case ram memory is over
DF=as.data.frame(MODELOS)
DF=na.omit(DF)
DISTAN=vegdist(DF[,2:ncol(DF)],"jaccard")
Or more reproducibly:
nsites <- 138037
nspp <- 89
DF <- matrix(0,nrow=nsites,ncol=nspp)
DISTAN=vegdist(DF,"jaccard")
Almost immediately it produces the error:
Error in double(N * (N - 1)/2) : vector size specified is too large
I think this a memory error, but i don´t know why if I have a pc with 32GB of ram and 1 Tera of HDD.
I also try to do a dist matrix with the function dist
from package proxy:
library(proxy)
vector=dist(DF, method = "Jaccard")
it starts to run but when it gets to 10 GB of ram, a window announces that R committed an error and it will close, so it closes and start a new section.
I really don't know what is going on and less how to solve this, can anybody help me?