censor_values function

Censor values above or below a threshold

Censor values above or below a threshold

Replaces values in a vector with NA when above or below a censor level.

Censoring is values censor_symbol censor_threshold are censored, for example with the defaults (values lte 0 set to NA) all values <= 0 are replaced with NA.

censor_values( value, censor_threshold = 0, censor_symbol = c("lte", "lt", "gt", "gte") )

Arguments

  • value: 'numeric' vector. Values to censor.

  • censor_threshold: 'numeric' value. Threshold to censor values on. Default is 0.

  • censor_symbol: 'character' string.

    Inequality symbol to censor values based on censor_threshold.

    Accepted values are "gt" (greater than),

    "gte" (greater than or equal to),

    "lt" (less than),

    or "lte" (less than or equal to).

    Default is "lte".

Returns

'numeric' vector with censored values replaced with NA

Examples

censor_values(value = seq.int(1, 10, 1), censor_threshold = 5)
  • Maintainer: Colin Penn
  • License: CC0
  • Last published: 2024-08-28