Make a grid of spatial bins

Share:

Description

make.grid creates a space-time grid object of class “stgrid” for use with the functions gridresid and devresid.

Usage

1
make.grid(stw, grid = c(10, 10))

Arguments

stw

A space-time window object of class “stwin” to be divided into space-time bins.

grid

A vector representing the number of rows and columns in the grid.

Details

The space-time window, stw, is divided into a grid of space-time bins using the grid argument to determine the number of intervals in the x and y directions. The total number of bins will be the product of the elements of grid.

If grid is not specified, the default grid is 10 x 10, resulting in 100 total bins.

Value

Outputs an object of class “stgrid”, which is a list of

grid.full

A data frame where each row represents a bin. There are four columns, xmin, xmax, ymin, and ymax, which represent the x and y limits of the bins.

Author(s)

Robert Clements

See Also

stwin, gridresid

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#===> create a space-time window  <===#
xcoord <- c(0, 10)
ycoord <- c(0, 20)
tcoord <- c(0, 100)
stw <- stwin(xcoord, ycoord, tcoord)

#===> create a 10 x 10 grid <===#
gf <- make.grid(stw)

#===> create a 10 x 20 grid <===#
gf <- make.grid(stw, c(10, 20))
nrow(gf$grid.full)
ncol(gf$grid.full)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.