powered by
Sum values of Raster objects by row or column.
# S4 method for Raster rowSums(x, na.rm=FALSE, dims=1L,...) # S4 method for Raster colSums(x, na.rm=FALSE, dims=1L,...)
Raster* object
logical. If TRUE, NA values are ignored
TRUE
NA
this argument is ignored
additional arguments (none implemented)
vector (if x is a RasterLayer) or matrix
x
See cellStats for summing all cells values
cellStats
# NOT RUN { r <- raster(ncols=2, nrows=5) values(r) <- 1:10 as.matrix(r) rowSums(r) colSums(r) # }
Run the code above in your browser using DataLab