Re: [R] Euclidean distance function

2012-08-24 Thread Rui Barradas
Hello, You don't need to write a function. Try the following. nms <- paste0("species", 1:4) mat <- matrix(rnorm(16), ncol=4, dimnames = list(nms, nms)) ?dist dist(mat) dist(mat, diag = TRUE, upper = TRUE) Hope this helps, Rui Barradas Em 24-08-2012 11:56, Arbuckle escreveu: Hi, I should pr

Re: [R] Euclidean distance function

2012-08-24 Thread Arbuckle
Thank you kindly for both of the replies I've received, that does indeed work perfectly. I had been looking at the description of that function and it reads as though it only deals with 2-dimensional data. Thanks again! Kev -- View this message in context: http://r.789695.n4.nabble.com/Euclide

Re: [R] Euclidean distance function

2012-08-24 Thread Jean V Adams
Kev, The dist() function handles more than 2 dimensions. Using the example you provided ... mydat <- structure(list(Species = c("spA", "spB", "spC", "spD"), x = c(2.9, 5.5, 1.4, 8.3), y = c(34.2, 46.5, 48.6, 56.1), z = c(0.54, 0.45, 0.84, 0.48), n = c(15.7, 19.