dichotomize: Takes a raster and returns binary representation

Description Usage Arguments Value Author(s) Examples

Description

This simple function takes an in put raster and it returns an identical one that has been dichotomized (e.g., values are 0/1).

Usage

1
dichotomize(x, hi.val = 1, low.val = 0)

Arguments

x

Input raster.

hi.val

Value to assign to non-NA values (default = 1.0)

lo.val

Value to assign to NA values (default = 1.0)

Value

A copy of the raster (including projection) with NA values set to lo.val and non-NA values set to hi.val.

Author(s)

Rodney J. Dyer <rjdyer@vcu.edu>

Examples

1
2
3
4
5
6
7
library(raster)
x <- matrix( rnorm(25), nrow=5)
x[1,4] <- x[2,4] <- NA
r <- raster( x )
d <- dichotomize(r)
d
values(d)

dyerlab/LiDARlicious documentation built on May 15, 2019, 7:21 p.m.