View source: R/region_subset.R
region_subset | R Documentation |
region_subset
generates a region subset of matrix values based on a subset of coordinates within the original region (using nearest spatial neighbor if coordinates differ).
region_subset(orig_coords = NULL, orig_matrix = NULL, subset_coords = NULL)
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). |
A matrix of values corresponding to the subset region coordinates (using nearest spatial neighbor if original and subset coordinates differ).
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.