bound_vec: Bound a numeric vector

View source: R/general_functions.R

bound_vecR Documentation

Bound a numeric vector

Description

Bound a numeric vector with upper and lower limits, so that anything outside the limit is replaced by the limit.

Usage

bound_vec(x, bounds)

Arguments

x

A number or numeric vector

bounds

A vector c(a,b) which identify the lower (a) and upper (b) limits, respectively.

Examples

bound_vec(1:20,c(2.5,10.5))
dplyr::mutate(data.frame(a=1:20),b=bound_vec(a,c(3.2,15.7)))

gopalpenny/ggp documentation built on Oct. 22, 2023, 10:13 p.m.