

If a division of the number of columns or rows with factor does not return an integer, the extent of the resulting Raster object will either be somewhat smaller or somewhat larger than the original RasterLayer. Likewise, fact=c(2,3,4) aggregates cells in groups of 2 (rows) by 3 (columns) and 4 (layers).Īggregation starts at the upper-left end of a raster (you can use flip if you want to start elsewhere). If two numbers are supplied, e.g., fact=c(2,3), the first will be used for aggregating in the horizontal direction, and the second for aggregating in the vertical direction, and the returned object will have 2*3=6 times fewer cells. For example, fact=2 will result in a new Raster* object with 2*2=4 times fewer cells. If necessary this number is adjusted according to the value of expand. The number of cells is the number of cells of x divided by fact*fact (when fact is a single number) or prod(fact) (when fact consists of 2 or 3 numbers). Hijmans and Jacob van Etten DetailsĪggregation of a x will result in a Raster* object with fewer cells. If TRUE borders between touching or overlapping polygons are removed 'first' function(x)x or 'last' function(x)x or modal for these variables Be careful with character and factor variables (you can use, e.g. mean), the second element is a vector of column names (or indices) that need to summarize with that function. This should be a list of lists in which each element of the main lists has two items.

List with function(s) and variable(s) to summarize. You can also supply a vector with a length of length(x) The default setting is to use no variables and aggregate all polygons. The variables (column names or numbers) that should be used to aggregate (dissolve) the SpatialPolygons by only maintaining unique combinations of these variables. If x is a Raster* object, additional arguments as for writeRasterĬharacter or integer. If TRUE, NA cells are removed from calculations If TRUE the output Raster* object will be larger than the input Raster* object if a division of the number of columns or rows with factor is not an integer Or two integers (horizontal and vertical aggregation factor) or three integers (when also aggregating over layers). Aggregation factor expressed as number of cells in each direction (horizontally and vertically).

Raster* object or SpatialPolygons* object
