area(x, ...)weights=TRUEna.rm=FALSE Logical. If TRUE, cells that are NA in x are ignored
weights=FALSE Logical. If TRUE, area of each cells is divided by the total area of all cells that are not NA
filename Filename for the output RasterLayer
format Character. Output file type. See writeRaster
datatype Character. Output data type. See dataType
overwrite Logical. If TRUE, "filename" will be overwritten if it exists
progress Character. Choose from "text", "window", or "" (the default, no progress bar)
}
If x is a RasterStack/Brick, a RasterBrick will be returned if na.rm=TRUE. However, if na.rm=FALSE, a RasterLayer is returned, because the values would be the same for all layers.r <- raster(nrow=18, ncol=36)
a <- area(r)Run the code above in your browser using DataLab