calcHnn: grid to point nearest neighbours

Description Usage Arguments Details Value

View source: R/calcHnn.R

Description

Fill in a LOGICAL matrix indicating for each location in a [p] set the corresponding nearest neighbour in a [ng] grid.

Usage

1
calcHnn(G, gLON, gLAT, pos)

Arguments

G

LIST, a codegmeta6 object as defined by the package spgrass6 with grid metadata for regular grids

gLON

REAL, [ng] coordinates for irregular grids, longitude

gLAT

REAL, [ng] coordinates for irregular grids, latitude

pos

REAL, [p,2], point coordinates

Details

This function would most commonly be called by analyseUG. For irregular grids, nearest grid neighbours to the point dataset is calculated via nn2dist in the package splancs.

Value

A [p,ng] dgCMatrix as provided by the package Matrix, where p is the number of point locations, and ng is the number of cells in the grid. The grid is assumed to be sortened starting fro the upper left and advancing by row.


garciapintado/rDAF documentation built on May 25, 2019, 7:26 p.m.