Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

limit

Limit the magnitude of elements of a vector


Description

Deals appropriately with objects with a few very large elements

Usage

limit(x, upper=quantile(Re(x),0.99,na.rm=TRUE),
         lower=quantile(Re(x),0.01,na.rm=TRUE),
         na = FALSE)

Arguments

x

Vector of real or complex values

upper

Upper limit

lower

Lower limit

na

Boolean, with default FALSE meaning to “clip” x (if real) by setting elements of x with x>high to high; if TRUE, set such elements to NA. If x is complex, this argument is ignored

Details

If x is complex, low is ignored and the function returns x, after executing x[abs(x)>high] <- NA.

Author(s)

Robin K. S. Hankin

Examples

x <- c(rep(1,5),300, -200)
limit(x,100)
limit(x,upper=200,lower= -400)
limit(x,upper=200,lower= -400,na=TRUE)

elliptic

Weierstrass and Jacobi Elliptic Functions

v1.4-0
GPL-2
Authors
Robin K. S. Hankin [aut, cre] (<https://orcid.org/0000-0001-5982-0415>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.