score_less: Score a Variable Where Lower Values Are Better

View source: R/scoring.R

score_lessR Documentation

Score a Variable Where Lower Values Are Better

Description

Applies a "less is better" linear scoring function, transforming raw variable values to a 0–1 score. Suitable for soil indicators where lower values denote better soil quality, such as bulk density, electrical conductivity, or heavy metal concentrations (Andrews et al., 2004).

The score is computed as:

S_i = \frac{x_{\max} - x_i}{x_{\max} - x_{\min}}

Usage

score_less(x, x_min = NULL, x_max = NULL)

Arguments

x

Numeric vector of raw variable values.

x_min

Numeric. Lower bound. Defaults to min(x).

x_max

Numeric. Upper bound. Defaults to max(x).

Value

Numeric vector of scores in [0, 1].

References

Andrews, S.S., Karlen, D.L., & Cambardella, C.A. (2004). The soil management assessment framework. Soil Science Society of America Journal, 68(6), 1945–1962. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2136/sssaj2004.1945")}

Examples

bd <- c(0.9, 1.1, 1.3, 1.5, 1.7)   # Bulk Density (g/cm3)
score_less(bd)

# With domain bounds
score_less(bd, x_min = 0.8, x_max = 2.0)


SQIpro documentation built on April 20, 2026, 5:06 p.m.