Skip to contents

Wraps a SELECT carrying at least ms_merge_key, ds_key, val so the rows of the density datasets are scaled by their taxon's factor and capped at 100; every other row, and every other column (mkey_id, cell_id, ...), passes through unchanged (m.* REPLACE). A taxon without a factor row keeps its survey values (f = 1).

Usage

density_calibrate_sql(sql, dens_ds, factors = "dens_cal")

Arguments

sql

character; the merge-input SELECT (ms_merge_key, ds_key, val + any other columns).

dens_ds

character vector; the density dataset keys (e.g. c("gm", "nc", "cce")).

factors

character; the relation density_cal_factors_sql() produced (ms_merge_key, f).

Value

SQL string.