Learn R Programming

raster (version 1.8-3)

crosstab: Cross-tabulate

Description

Cross-tabulate two RasterLayer objects to create a contingency table.

Usage

crosstab(x, y, ...)

Arguments

x
RasterLayer object
y
RasterLayer object
...
Additional arguments. See Details

Value

  • A table or matrix

Details

A full call to the crosstab method for a RasterLayer is: crosstab(x, y, digits=0, long=FALSE, progress) rll{ digits Integer. The number of digits for rounding the values before cross-tabulation long Logical. If TRUE the results are returned in 'long' format (matrix with three columns) instead of a table progress Character. "text", "window", or "" (the default, no progress bar) ... Additional arguments that can be passed on to table, such as exclude=NULL to include NA values in the tabulation }

See Also

freq, zonal

Examples

Run this code
r <- raster()
r[] = runif(ncell(r)) * 5
s = setValues(r, runif(ncell(r)) * 10)
crosstab(r,s)

Run the code above in your browser using DataLab