R/as.SpatialGrid.prevR.r
as.SpatialGrid.Rd
This function generates a spatial rectangular grid from the slot boundary
of an object of class prevR
; function used in particular
by the methods kde()
, krige()
and idw()
.
# S4 method for prevR
as.SpatialGrid(object, nb.cells = 100, cell.size = NULL)
object of class prevR.
number of cells on the longest side of the studied area
(unused if cell.size
is defined).
size of each cell (in the unit of the projection).
Object of class sp::SpatialGrid.
This function generates a spatial rectangular grid, each cell being a square
of side cell.size
. If cell.size
is not defined, side of cells will be
calculated as the longest side of the slot boundary
of object
divided
by nb.cells
.
str(as.SpatialGrid(fdhs))
#> Formal class 'SpatialGrid' [package "sp"] with 3 slots
#> ..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots
#> .. .. ..@ cellcentre.offset: num [1:2] -5.52 4.74
#> .. .. ..@ cellsize : num [1:2] 0.103 0.103
#> .. .. ..@ cells.dim : int [1:2] 90 99
#> ..@ bbox : num [1:2, 1:2] -5.57 4.68 3.74 14.93
#> .. ..- attr(*, "dimnames")=List of 2
#> .. .. ..$ : NULL
#> .. .. ..$ : chr [1:2] "min" "max"
#> ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
#> .. .. ..@ projargs: chr "+proj=longlat +datum=WGS84 +no_defs"
#> .. .. ..$ comment: chr "GEOGCRS[\"unknown\",\n DATUM[\"World Geodetic System 1984\",\n ELLIPSOID[\"WGS 84\",6378137,298.25722"| __truncated__
str(as.SpatialGrid(fdhs, nb.cells=200))
#> Formal class 'SpatialGrid' [package "sp"] with 3 slots
#> ..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots
#> .. .. ..@ cellcentre.offset: num [1:2] -5.52 4.74
#> .. .. ..@ cellsize : num [1:2] 0.0517 0.0517
#> .. .. ..@ cells.dim : int [1:2] 181 199
#> ..@ bbox : num [1:2, 1:2] -5.54 4.71 3.82 15
#> .. ..- attr(*, "dimnames")=List of 2
#> .. .. ..$ : NULL
#> .. .. ..$ : chr [1:2] "min" "max"
#> ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
#> .. .. ..@ projargs: chr "+proj=longlat +datum=WGS84 +no_defs"
#> .. .. ..$ comment: chr "GEOGCRS[\"unknown\",\n DATUM[\"World Geodetic System 1984\",\n ELLIPSOID[\"WGS 84\",6378137,298.25722"| __truncated__