as.logical {raster} | R Documentation |
Change cell values to logical or integer values
Description
Change values of a Raster* object to logical or integer values. With as.logical
, zero becomes FALSE
, all other values become TRUE
. With as.integer
values are truncated.
Usage
## S4 method for signature 'Raster'
as.logical(x, filename='', ...)
## S4 method for signature 'Raster'
as.integer(x, filename='', ...)
Arguments
x |
Raster* object |
filename |
character. Output filename (optional) |
... |
additional optional arguments as for |
See Also
Examples
r <- raster(nrow=10, ncol=10)
set.seed(0)
values(r) <- runif(ncell(r)) * 10
r
r <- as.integer(r)
r
as.logical(r)
[Package raster version 3.6-26 Index]