grid_neibs_ord1: Get directional neighbours from a regular grid

Description Usage Arguments Value

View source: R/gen_data_utils.R

Description

Given a matrix detailing the position of location in a regular grid, returns a matrix specifying the IDs of immediate neighbours to the right, left, top and bottom of each location.

Usage

1
grid_neibs_ord1(sites, klist)

Arguments

sites

a matrix or data.frame with site ID equal to row number and two columns, corresponding to position in x and y

klist

a matrix like the ones returned by consecutive use of spdep::dnearneigh and spdep::nblag where a value higher than 0 implies that the row and column locations are neighbours

Value

A matrix with nrow(sites) rows and four columns containing the ID of a location's neighbour in each cardinal direction (top, right, bottom and left).


mrfoliveira/Evaluation-procedures-for-forecasting-with-spatio-temporal-data documentation built on April 11, 2021, 10:50 a.m.