points_positions | R Documentation |
If you have k points and distances between all pairs function will try to find locations for those points in n-dimensional Cartesian Space.
points_positions(dm, error = 0.001, fnc = "mean", n_dim = NULL, max_iter = 200)
dm |
Distance matrix |
error |
error threshold, stop condition - default value 0.001 means 0.1% |
fnc |
method for calculation tolerance for stop conditions, by default "mean" (mean error for all distances between points), other option - "max", see vignette "dist2location algorithms" for details |
n_dim |
Dimension of space where points should be located. When distance matrix includes information about k points and n is not set, n-1 dimensional space will be chosen |
max_iter |
stop condition, if number of iteration is exceeded (default value = 200) function will stop |
Algorithms used by this function adjust point locations to optimize error related with difference between current and expected (set as input in Distance Matrix) distances between points. The criterion for decision to stop the calculations is set in parameters error and max_iter Default values (stop = 0.001, max_iter = 100).
Run vignette("dist2location_algorithms") for details.
To check how to create Distance Matrix run: vignette("dist2location")
list l l[["positions]] - data frame with point with positions (n rows for n points, m columns for m dimensions) l[["error]] - error
# Find positions of vertexes of Regular tetrahedron (where distances between all vertexes are equal to 1)
# Define distance matrix
dist_m <- matrix(c(0,1,1,1,
1,0,1,1,
1,1,0,1,
1,1,1,0), nrow = 4, ncol = 4, byrow = TRUE)
# Find positions
result <- points_positions(dist_m)
positions <- result[["positions"]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.