Learn R Programming

lacunaritycovariance (version 1.1-7)

isbinarymap: Test if an im object is a binary map

Description

Tests whether xi is a binary map. The pixel values must be of logical type (TRUE, FALSE and NA only), or numerical (1, 0 or NA).

Usage

isbinarymap(xi, requiretrue = FALSE)

Value

Logical value. TRUE if xi is a binary map. Otherwise FALSE. If requiretrue = TRUE and xi is not a binary map then an error will occur.

Arguments

xi

an image object

requiretrue

Logical. If TRUE then isbinarymap will error if xi is NOT a binary map.

Examples

Run this code
# The following return TRUE
isbinarymap(as.im(heather$coarse, na.value = 0))
isbinarymap(as.im(heather$coarse, na.value = FALSE, value = TRUE))

# The following return FALSE
isbinarymap(as.im(heather$coarse, na.value = 0.2, value = 1))
isbinarymap(as.im(heather$coarse, na.value = 0, value = 1.5))

Run the code above in your browser using DataLab