powered by
A wrapper function for the dist function in the stats package. It replaces NA values in the distance matrix by the maximum distance in the same matrix, therefore prevents cases where hclust fails because of NA distances.
dist
stats
NA
robustDist(x, ...)
The same as dist, however without NAs.
a numeric matrix, data frame or ‘dist’ object
Other parameters passed to the dist function.
Jitao David Zhang <jitao_david.zhang@roche.com>
In the rare case of all-NA distance matrices, all values are assigned arbitrarily to one.
mymat <- matrix(c(3,2,1,NA,NA,NA, 4,1,2,NA,NA,NA, NA,NA,NA,5,1,2), ncol=6, byrow=TRUE) dist(mymat) robustDist(mymat)
Run the code above in your browser using DataLab