defines spatial grid by offset, cell size and dimensions

SpatialPixelsDataFrame(points, data, tolerance = sqrt(.Machine$double.eps),
                proj4string = CRS(as.character(NA)), round = NULL, grid = NULL)
SpatialGridDataFrame(grid, data, proj4string = CRS(as.character(NA)))

Arguments

points

coordinates, either as numeric matrix or as object of class SpatialPoints-class

grid

grid topology; object of class GridTopology-class; for calls to SpatialPixelsDataFrame a value of NULL implies that this will be derived from the point coordinates

data

data.frame; contains the attribute (actual grid) data

tolerance

precision up to which extent points should be exactly on a grid

round

default NULL, otherwise a value passed to as the digits argument to round for setting cell size

proj4string

object of class CRS-class in the first form only used when points does not inherit from Spatial-class

Value

SpatialPixelsDataFrame returns an object of class SpatialPixelsDataFrame-class; SpatialGridDataFrame returns an object of class SpatialGridDataFrame-class.

Note

SpatialPixels stores grid topology and coordinates of the actual points, which may be in the form of a subset (set of pixels) of a full grid. To find out or change this, see fullgrid and SpatialGrid-class.

See also

gridded, gridded<-, SpatialGrid, SpatialGrid-class

Examples

data(meuse.grid) m = SpatialPixelsDataFrame(points = meuse.grid[c("x", "y")], data = meuse.grid) class(m)
#> [1] "SpatialPixelsDataFrame" #> attr(,"package") #> [1] "sp"
#> Object of class SpatialPixelsDataFrame #> Coordinates: #> min max #> x 178440 181560 #> y 329600 333760 #> Is projected: NA #> proj4string : [NA] #> Number of points: 3103 #> Grid attributes: #> cellcentre.offset cellsize cells.dim #> x 178460 40 78 #> y 329620 40 104 #> Data attributes: #> x y part.a part.b #> Min. :178460 Min. :329620 Min. :0.0000 Min. :0.0000 #> 1st Qu.:179420 1st Qu.:330460 1st Qu.:0.0000 1st Qu.:0.0000 #> Median :179980 Median :331220 Median :0.0000 Median :1.0000 #> Mean :179985 Mean :331348 Mean :0.3986 Mean :0.6014 #> 3rd Qu.:180580 3rd Qu.:332140 3rd Qu.:1.0000 3rd Qu.:1.0000 #> Max. :181540 Max. :333740 Max. :1.0000 Max. :1.0000 #> dist soil ffreq #> Min. :0.0000 1:1665 1: 779 #> 1st Qu.:0.1193 2:1084 2:1335 #> Median :0.2715 3: 354 3: 989 #> Mean :0.2971 #> 3rd Qu.:0.4402 #> Max. :0.9926