Limit the magnitude of elements of a vector
Deals appropriately with objects with a few very large elements
limit(x, upper=quantile(Re(x),0.99,na.rm=TRUE), lower=quantile(Re(x),0.01,na.rm=TRUE), na = FALSE)
x |
Vector of real or complex values |
upper |
Upper limit |
lower |
Lower limit |
na |
Boolean, with default |
If x
is complex, low
is ignored and the function returns
x
, after executing x[abs(x)>high] <- NA
.
Robin K. S. Hankin
x <- c(rep(1,5),300, -200) limit(x,100) limit(x,upper=200,lower= -400) limit(x,upper=200,lower= -400,na=TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.