gower
gower copied to clipboard
fast distance matrix
We can do a dist
matrix naively as follows:
gower_distmat <- function(x,...){
i <- seq_len(nrow(x))
I <- rep(i, each=nrow(x))
J <- rep(i, times=nrow(x))
d <- gower_dist(x[I,],x[J,],...)
as.dist(matrix(d, nrow=nrow(x)))
}
but that's pretty memory-inefficient. Should do this from C
level w/o copying.