View source: R/centroid.scaled.distances.R
| centroid.scaled.distances | R Documentation |
Calculate the matrix of distances between shape coordinates, scaled by centroid size
centroid.scaled.distances(m, scale = TRUE, symmetrical = FALSE)
m |
A matrix containing XY shape coordinates for p landmarks |
scale |
A logical argument for whether to scale the distances by centroid size |
symmetrical |
A logical argument for whether to keep the output matrix symmetrical.
If |
Returns a matrix, with dimensions p x p.
Dave Angelini david.r.angelini@gmail.com [aut, cre]
x <- matrix(c(9,49, 24,54, 51,28, 81,54, 81,23, 86,32), ncol = 2, byrow = TRUE)
centroid.scaled.distances(x)
centroid.scaled.distances(x, symmetrical = TRUE)
centroid.scaled.distances(x, symmetrical = TRUE, scale = FALSE)
# cross validation
df <- data.frame(matrix(nrow = dim(x)[1], ncol = dim(x)[1]))
for (i in (1:dim(x)[1])) {
df[i,] <- unlist(apply(x, 1, distance, XY=x[i,]))
}
df
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.