Last chance! 50% off unlimited learning
Sale ends in
## S3 method for class 'Raster,Raster':
crosstab(x, y, digits=0, long=FALSE, useNA=FALSE, progress='', ...)
## S3 method for class 'RasterStackBrick,missing':
crosstab(x, digits=0, long=FALSE, useNA=FALSE, progress='', ...)
x
is a RasterLayer; Can be missing if x
is a RasterStack or RasterBrickTRUE
the results are returned in 'long' format data.frame instead of a tableNA
valuesfreq
, zonal
r <- raster(nc=5, nr=5)
r[] <- runif(ncell(r)) * 2
s <- setValues(r, runif(ncell(r)) * 3)
crosstab(r,s)
rs <- r/s
r[1:5] <- NA
s[20:25] <- NA
x <- stack(r, s, rs)
crosstab(x, useNA=TRUE, long=TRUE)
Run the code above in your browser using DataLab