View source: R/ordering_functions.R
order_dist_to_point | R Documentation |
Return the ordering of locations increasing in their distance to some specified location
order_dist_to_point(locs, loc0, lonlat = FALSE)
locs |
A matrix of locations. Each row of |
loc0 |
A vector containing a single location in R^d. |
lonlat |
TRUE/FALSE whether locations are longitudes and latitudes. |
A vector of indices giving the ordering, i.e.
the first element of this vector is the index of the location nearest to loc0
.
n <- 100 # Number of locations
d <- 2 # dimension of domain
locs <- matrix( runif(n*d), n, d )
loc0 <- c(1/2,1/2)
ord <- order_dist_to_point(locs,loc0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.