I have a question about clustering using a distance matrix, but sparse.
Is there a sparse distance object format that does not expand the matrix and can work with the sparse representation?
Currently I'm doing the following
# read sparse matrix
sparse <- readMM('sparse-matrix')
distance <- as.dist(sparse)
sparse-matrix is already the correct distance matrix, which has NA's for entries that are not connected.
>sparse
[1,] . . .
[2,] 1 . .
[3,] 1 . .
> as.dist(sparse)
1 2
2 1
3 1 0
But converting it with as.dist fails with
Error in asMethod(object) : negative length vectors are not allowed
Presumably, because it expands the matrix to a complete form. The matrix (NxN) size is N = 49281 This format is needed (dist object) by for example the hclust method
Similar Question without any answer on the R help list