dist(x, metric = "euclidean")
Mardia, K. V., Kent, J. T. and Bibby, J. M. (1979). Multivariate Analysis. Academic Press, London.
# create a sample object x <- votes.repub dist(x,"max") # distances among rows by maximum dist(t(x)) # distances among cols in Euclidean metric# below is a function that converts a distance structure to a matrix dist2full <- function(dis) { n <- attr(dis, "Size") full <- matrix(0, n, n) full[lower.tri(full)] <- dis full + t(full) }