setGridOrder | R Documentation |
Specify or retrieve the ordering in which a grid is stored in a vector (or matrix).
setGridOrder(x, refpoint, cycle)
setGridOrder_sp(x, G = 2)
setGridOrder_array(x, G = 2)
gridOrder_sp(G = 2)
gridOrder_gstat(G = 2)
gridOrder_array(G = 2)
gridOrder_GSLib(G = 2)
x |
a data container for the elements of the grid; the grid order is stored as an attribute to it |
refpoint |
a string specifying which point of the grid corresponds
to the first element of |
cycle |
a permutation of the integers |
G |
number of geographic dimensions of the setting, typically |
A "gridOrder" attribute is a list consisting of two named elements:
one of "topleft", "bottomleft", "topright" or "bottomright" in 2D, or
also of "topleftsurf", "bottomleftsurf", "toprightsurf", "bottomrightsurf", "topleftdeep","bottomleftdeep",
"toprightdeep" or "bottomrightdeep" in 3D ("deep" is accessory, i.e. "topleft"== "topleftdeep"),
indicating the location on the grid of the first point of the object x
a permutation of 1:G
indicating in which order run the dymensions, from faster to slower
Thus, a conventional ordering of a (nX*nY)-element vector into a matrix to plot with graphics::image()
corresponds to an refpoint="bottomleft"
and cycle=1:2
, i.e. start with the lower left corner
and run first by rows (eastwards), then by columns (northwards). This is constructed by
gridOrder_array(G)
, and can be directly set to an object x
by setGridOrder_array(x,G)
;
gridOrder_GSLib
is an alias for gridOrder_array
.
The grids from package "sp" (and many other in R), on the contrary follow the convention
refpoint="topleft"
and cycle=1:2
, i.e. start with the upper left corner
and run first by rows (eastwards), then by columns (southwards). This is constructed by
gridOrder_sp(G)
, and can be directly set to an object x
by setGridOrder_sp(x,G)
; gridOrder_gstat
is an alias for gridOrder_sp
.
setGridOrder(x,...)
returns the object x
with the grid order description attached
as an attribute "gridOrder"; getGridOrder(x)
retrieves this attribute and returns it.
setGridOrder_sp
: Set or get the ordering of a grid
setGridOrder_array
: Set or get the ordering of a grid
gridOrder_sp
: Set or get the ordering of a grid
gridOrder_gstat
: Set or get the ordering of a grid
gridOrder_array
: Set or get the ordering of a grid
gridOrder_GSLib
: Set or get the ordering of a grid
sortDataInGrid()
for ways of reordering a grid
gt = sp::GridTopology(cellcentre.offset=c(1,11), cellsize=c(1,1), cells.dim=c(5,3))
sp::coordinates(sp::SpatialGrid(grid=gt))
gridOrder_sp(2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.