num_squeeze: Squeezing numeric values within specified range

Description Usage Arguments Value Examples

View source: R/num_squeeze.R

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

1
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

1
2
3
4
5
6
7
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/AVRCHelp documentation built on Oct. 26, 2018, 8:17 p.m.