Hello, 

 

I am trying to compute a distance measure for the rows (var1) in a
sparse matrix: 

 

require(Matrix)

dfx = xtabs(~ var1 + var2, data = df, sparse = T, drop.unused.levels = T
)

dm = dist(dfx)

 

on my data frame.  Note that I am using the xtabs function from the
Matrix package, not R base.  The thing is that length(unique(df$var1)) =
15000 and length(unique(df$var1)) = 1600, so the matrix is huge.  Thus,
when I run dist(dfx), I get the error message:

 

Error: cannot allocate vector of size 885.1 Mb.

 

Anyone know how I might resolve the issue?

 

Thanks,

 

Solomon

 


	[[alternative HTML version deleted]]

