make_hsd: Discrete Habitat Suitability Function Generator

Description Usage Arguments Value Examples

View source: R/rrevaluate.r

Description

Generate a discrete habitat suitability function given parameter windows and scores.

Usage

1
make_hsd(expr, score)

Arguments

expr

List of expressions evaluating the value of a parameter x. All expressions should be mutually exclusive. See examples for how to construct the expressions.

score

Vector of scores assigned when a given expression evaluates as TRUE.

Value

A function representing the habitat suitability index.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
windows = list(
  optimal = expression(x >= 14 & x <= 18),
  suitable = expression(x < 14 | (x >= 18 & x < 21)),
  stressful = expression(x >= 21 & x <= 25),
  unsuitable = expression(x > 25)
)
scores = c(3, 2, 1, 0)

make_hsd(windows, scores)
make_hsd(windows, names(windows))

mkoohafkan/rremat documentation built on July 3, 2021, 12:06 p.m.