capValues: Decrease all values greater than a maximum specified value.

View source: R/capValues.R

capValuesR Documentation

Decrease all values greater than a maximum specified value.

Description

capValues takes a numeric vector and returns a vector in which all values greater than a specified maximum are reset to that maximum value.

Usage

capValues(DataCol, maxVal = 0.95)

Arguments

DataCol

A vector of numeric values.

maxVal

A numeric value specifying the maximum value or quantile at which to cap all data.

Details

The maximum may be specified either as a quantile or as a number.

If maxVal is less than one, it is interpreted as a quantile, otherwise it is interpreted as the maximum value to return.

The default value is 0.95, which caps all values in the input at the 95 percent quantile.

Value

A vector of numeric values where no value is greater than the maximum specified by maxVal.

Example

x = seq(1,10) y <- capValues(x, 0.75) z <- capValues(x, 5) rbind(x, y, z)

Author(s)

Andi Stephens


nwfsc-assess/PacFIN.Utilities documentation built on March 19, 2024, 11:54 p.m.