Skip to contents

Convenience wrapper around add_effects that keeps only negative effects, represented by rows with loss > 0.

Usage

add_losses(
  x,
  losses = NULL,
  effect_type = c("delta", "after"),
  effect_aggregation = c("sum", "mean")
)

Arguments

x

A Problem object created with create_problem. It must already contain feasible actions; run add_actions first.

losses

Alias of effects, used for symmetry with add_benefits().

effect_type

Character string indicating how supplied effect values are interpreted. Must be one of:

  • "delta": values represent signed net changes,

  • "after": values represent after-action amounts and are converted to net changes relative to baseline feature amounts.

effect_aggregation

Character string giving the aggregation used when converting raster values to planning-unit level. Must be one of "sum" or "mean".

Value

An updated Problem object containing:

dist_effects

The canonical filtered effects table, containing only rows with loss > 0.

dist_loss

A convenience table containing only the loss component.

losses_meta

Metadata for the stored loss table.