range.rv
returns a 2-component random vector containing the
distributions of the minimum and the maximum values of all the given
arguments.
# S3 method for rv
range(..., na.rm = FALSE, finite = FALSE)
further arguments passed to or from other methods
logical, indicating if NAs should be omitted
logical, indicating if all non-finite elements should be omitted
This is the rv-compatible version of the function range
.
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv")
.
x <- rvnorm(mean=1:10, sd=1)
print(range(x))
#> name mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
#> [1] min 0.69 0.85 -1.4 -0.85 0.13 0.68 1.3 2.3 2.5 200
#> [2] max 10.16 0.88 8.1 8.50 9.58 10.18 10.7 11.8 12.2 200
print(quantile(x, c(0,1)))
#> name mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
#> [1] 0% 0.69 0.85 -1.4 -0.85 0.13 0.68 1.3 2.3 2.5 200
#> [2] 100% 10.16 0.88 8.1 8.50 9.58 10.18 10.7 11.8 12.2 200