isbinarymap: Test if an 'im' object is a binary map

View source: R/isbinarymap.R

isbinarymapR Documentation

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)

Arguments

xi

an image object

requiretrue

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

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.

Examples

# 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))

lacunaritycovariance documentation built on Nov. 2, 2023, 6:08 p.m.