clamp: Clamps values beyond a threshold to the threshold.

View source: R/clamp.R

clampR Documentation

Clamps values beyond a threshold to the threshold.

Description

This function returns its input, with all values beyond a threshold set to a specified value (default 0).

Usage

clamp(x, bias = 0, value = 0, logic = `<`)

Arguments

x

A numeric object.

bias

A hyperparameter that can be used to adjust x.

value

The value to set (clamp) other values to.

logic

A logical function that returns which in x should be clamped.

Value

Returns an object formatted identical to x

Author(s)

Avery Kruger

Examples

x <- matrix(rnorm(16,500,TRUE),4,4)
clamp(x)
clamp(x, logic = `>`)


avery-kruger/kitchen documentation built on May 7, 2024, 6:40 a.m.