crosstabDT | R Documentation |
A fast data.table
-based alternative to
raster::crosstab()
.
crosstabDT(x, y, digits = 0, long = FALSE, useNA = FALSE)
x |
A |
y |
If |
digits |
Integer. The number of digits for rounding the
values before cross-tabulation. Default is |
long |
Logical. If |
useNA |
Logical. Should the returned table or
|
Either a table or a data.table
recording the
frequency of each combination of raster values.
Joshua O'Brien
r <- raster(nc = 5, nr = 5) r[] <- runif(ncell(r)) * 2 s <- setValues(r, runif(ncell(r)) * 3) crosstabDT(r, s) rs <- r/s r[1:5] <- NA s[20:25] <- NA x <- stack(r, s, rs) crosstabDT(x, useNA = TRUE, long = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.