border.grid: Construct border for grid

View source: R/border.grid.R

border.gridR Documentation

Construct border for grid

Description

border.grid determines the border for data on a grid. x and y must define a regular or irregular grid. See Details.

Usage

border.grid(x, y, proj4string)

border_grid(x, y, proj4string)

borderGrid(x, y, proj4string)

BorderGrid(x, y, proj4string)

Arguments

x

A vector or matrix of x coordinates. See Details.

y

A vector or matrix of y coordinates. See Details.

proj4string

A projection string of class CRS-class. If not provided, then default values are used. This should be changed with caution.

Details

A regular grid is defined by ascending numeric vectors x and y. A vector x is ascending if x[i] < x[j] for i < j.

An irregular grid is defind by ascending matrices. A matrix x is ascending if x[i, j] < x[i, l] for j < l and if x[i, j] < x[k, j] and j < k.

Value

A SpatialPolygons object.

Author(s)

Joshua French

Examples

# create x and y defining square border
x = seq(min(lon), max(lon), length = 60)
y = seq(min(lat), max(lat), length = 80)
border = border.grid(x, y)
sp::plot(border)

# use lon and lat to define border of an irregular grid
border2 = border.grid(lon, lat)
sp::plot(border2)

hero documentation built on July 26, 2023, 5:11 p.m.