Dear All, I tried to build a distance matrix. The following example is using dis fucntion: a<- 1:100 grid <- as.matrix(expand.grid(a,a)) dis<-as.matrix(dist(grid)) This can create a 10000 x 10000 distance matrix, and the object size is about 764Mb. However, the actual usage of this operation is almost 2680Mb. In a 4G memory, 32 bit OS machine, this almost top the memory limit. Is there anyway to build a distance matrix without using that much memory (I hope just use 764Mb)? Thank you very much! SC [[alternative HTML version deleted]]