total: Total number of cells in a categorical Raster* object

Description Usage Arguments Value Examples

View source: R/total.R

Description

Count the number of cells belonging to each category in a Raster* object.

Usage

1
total(x, categories)

Arguments

x

Raster* object

categories

numeric vector containing land use categories. Only cells belonging to these categories will be counted

Value

A list containing the following components:

total

a matrix containing the total number of cells belonging to each category. Rows represent layers in the input Raster* object

categories

the categories included in the calculation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Sibuyan Island

## load observed land use data
obs <- ObsLulcRasterStack(x=sibuyan$maps,
                    pattern="lu",
                    categories=c(1,2,3,4,5),
                    labels=c("Forest","Coconut","Grass","Rice","Other"),
                    t=c(0,14))

total(x=obs)
total(x=obs[[1]])
total(x=obs[[2]])

lulcc documentation built on May 29, 2017, 12:59 p.m.