freq

0th

Percentile

Frequency table

Frequency table of the values of a RasterLayer.

Keywords
spatial, univar
Usage
# S4 method for RasterLayer
freq(x, digits=0, value=NULL, useNA='ifany', progress='', ...)

# S4 method for RasterStackBrick freq(x, digits=0, value=NULL, useNA='ifany', merge=FALSE, progress='', ...)

Arguments
x

RasterLayer

digits

non-negative integer for rounding the cell values. Argument is passed to round

value

numeric, logical or NA. An optional single value to only count the number of cells with that value

useNA

character. What to do with NA values? Options are "no", "ifany", "always". See to table

progress

character to specify a progress bar. Choose from 'text', 'window', or '' (the default, no progress bar)

merge

logical. If TRUE the list will be merged into a single data.frame

...

additional arguments (none implemented)

Value

matrix (RasterLayer). List of matrices (one for each layer) or data.frame (if merge=TRUE) (RasterStack or RasterBrick)

See Also

crosstab and zonal

Aliases
  • freq
  • freq,RasterLayer-method
  • freq,RasterStackBrick-method
Examples
# NOT RUN {
r <- raster(nrow=18, ncol=36)
r[] <- runif(ncell(r))
r[1:5] <- NA
r <- r * r * r * 5
freq(r)

freq(r, value=2)

s <- stack(r, r*2, r*3)
freq(s, merge=TRUE)
# }
Documentation reproduced from package raster, version 2.9-5, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.