num_squeeze: Squeezing numeric values within specified range

View source: R/num_squeeze.R

num_squeezeR Documentation

Squeezing numeric values within specified range

Description

Coerces numbers outside the specified range to the min or max value. low and high arguments default to '-Inf' and 'Inf' Function will return NULL if lower

Usage

num_squeeze(x, low = -Inf, high = Inf)

Arguments

x

vector of numeric values

low

lower limit of numeric range

high

upper limit of numeric range

Value

numeric vector

Examples

x = -100:100

num_squeeze(x)
num_squeeze(x, low = 0)
num_squeeze(x, low = -1e3, high = 1e3)
num_squeeze(x, low = -2, high = -5) #returns NULL with warning
num_squeeze(x, low = 0, high = 0)

Ajfrick/ajfhelpR documentation built on June 30, 2023, 12:56 a.m.