order_coordinate: Sorted coordinate ordering

View source: R/ordering_functions.R

order_coordinateR Documentation

Sorted coordinate ordering

Description

Return the ordering of locations sorted along one of the coordinates or the sum of multiple coordinates

Usage

order_coordinate(locs, coordinate)

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.

coordinate

integer or vector of integers in {1,...,d}. If a single integer, coordinates are ordered along that coordinate. If multiple integers, coordinates are ordered according to the sum of specified coordinate values. For example, when d=2, coordinate = c(1,2) orders from bottom left to top right.

Value

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

Examples

n <- 100             # Number of locations
d <- 2               # dimension of domain
locs <- matrix( runif(n*d), n, d )
ord1 <- order_coordinate(locs, 1 )
ord12 <- order_coordinate(locs, c(1,2) )

GPvecchia documentation built on June 22, 2024, 11:13 a.m.