order_dist_to_point: Distance to specified point ordering

Description Usage Arguments Value Examples

View source: R/ordering_functions.R

Description

Return the ordering of locations increasing in their distance to some specified location

Usage

1
order_dist_to_point(locs, loc0, lonlat = FALSE)

Arguments

locs

A matrix of locations. Each row of locs contains a location, which can be a point in Euclidean space R^d, a point in space-time R^d x T, a longitude and latitude (in degrees) giving a point on the sphere, or a longitude, latitude, and time giving a point in the sphere-time domain.

loc0

A vector containing a single location in R^d.

lonlat

TRUE/FALSE whether locations are longitudes and latitudes.

Value

A vector of indices giving the ordering, i.e. the first element of this vector is the index of the location nearest to loc0.

Examples

1
2
3
4
5
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)

GpGp documentation built on June 10, 2021, 1:07 a.m.