Skip to contents

Wraps a SELECT of id_col, cell_id, val[, ...] so that val is multiplied by the cell's weight (1 where the relation has no row) and gated rows (w = 0) are dropped. The relation is the union of zone_exclude_sql() rows at w = 0 and zone_weight_sql() rows; with an EMPTY relation the result is the input, row for row and value for value (the control run), which test-exclude.R asserts. Columns other than val (e.g. the per-cell er) pass through untouched: a weight acts on the distribution, never on the extinction risk.

Usage

zone_adjust_sql(sql, adj = "zone_adj", id_col = "mdl_key")

Arguments

sql

character; a SELECT producing id_col, cell_id, val and any other columns.

adj

character; the adjustment relation (id_col, cell_id, w).

id_col

character; "mdl_key" (default) or "mdl_seq".

Value

SQL string.