region_subset: Function generates a region subset of matrix values based on...

Description Usage Arguments Value Examples

View source: R/region_subset.R

Description

region_subset generates a region subset of matrix values based on a subset of coordinates within the original region (using nearest spatial neighbour if coordinates differ).

Usage

1
region_subset(orig_coords = NULL, orig_matrix = NULL, subset_coords = NULL)

Arguments

orig_coords

Data frame (or matrix) of original/full region of X-Y coordinates (WGS84) in longitude (degrees West) and latitude (degrees North).

orig_matrix

Matrix of original values with rows corresponding to the original/full region coordinates.

subset_coords

Data frame (or matrix) of X-Y subset region coordinates (WGS84) in longitude (degrees West) and latitude (degrees North).

Value

A matrix of values corresponding to the subset region coordinates (using nearest spatial neighbor if original and subset coordinates differ).

Examples

1
2
3
4
5
6
coordinates <- data.frame(x = rep(seq(-178.02, -178.06, -0.01), 5),
                          y = rep(seq(19.02, 19.06, 0.01), each = 5))
values <- matrix(seq(1, 25, 1))
subset <- data.frame(x = rep(seq(-178, -178.04, -0.005), 7), 
                     y = rep(seq(19.03, 19.06, 0.005), each = 9))
region_subset(coordinates, values, subset) # nearest neighbor interpolation

paleopop documentation built on Oct. 14, 2021, 9:09 a.m.