Learn R Programming

ursa (version 3.11.5)

ursa_match: Raster value matching

Description

ursa_match creates raster mask, which is corresponded to vector of reference values

Usage

# S3 method for ursaRaster
mtfrm(x)

ursa_match(obj, value)

Value

Object of class ursaRaster as a mask of correspondence to reference values

Arguments

x, obj

Object of class ursaRaster

value

Vector of reference values, generally, numeric. If obj is categorical, then values can be character for matching to category names.

Author

Nikita Platonov platonov@sev-in.ru

Details

ursa_match(obj,c("blue","yellow") is equal to obj=="blue" | obj=="yellow"

See Also

Comparison `==` in groupGeneric

Examples

Run this code
session_grid(NULL)
a <- colorize(ursa_dummy(1),name=c("low","medium","high"),stretch="equal")
ta <- as.table(a)
ta
c('category value for "low"'=category_value(a,"low"))
res <- c('match to single char'=ursa_match(a,c("medium"))
        ,'match to multiple num'=ursa_match(a,c(0,category_value(a,"high")))
        ,'match to multiple char'=ursa_match(a,c("low","high"))
        ,'logical OR' = a=="low" | a=="high")
res
c(band_n(res)[1]==ta[2],band_n(res)[3]==sum(ta[c(1,3)]))

Run the code above in your browser using DataLab