bound: Bound a vector

View source: R/misc.R

boundR Documentation

Bound a vector

Description

This helper function bounds a numeric vector on a minimum and maximum value.

Usage

bound(x, min = 0.01, max = 0.99)

Arguments

x

Numeric vector to be bounded

min

Minimum allowed value for vector "x"; default is 0.01

max

Maximum allowed value for vector "x"; default is 0.99

Value

Numeric vector of the same length as x with no values less than minimum nor greater than maximum.

Examples


x <- rnorm(1000, 0.5, 0.5)
bound(x)
bound(x, min = 0.2, max = 0.8)
bound(x, min = -0.1, max = 1.1)


vpnagraj/yawp documentation built on March 31, 2022, 9:56 a.m.