iemisc (version 0.9.8)

ranges: Sample range

Description

This function computes the sample range.

Usage

ranges(x, na.rm = FALSE, finite = FALSE)

Arguments

x

numeric vector

na.rm

logical vector that determines whether the missing values should be removed or not.

finite

logical vector that determines whether non-finite values should be removed or not.

Value

ranges as the difference between the maximum and minimum values in x as a numeric vector. Unlike the range, ranges can't take character vectors as arguments, only numeric vectors.

Details

"The range is the difference between the largest number and the smallest number in the set." Source: Onwubiko page 176.

The following statements are from range:

"If na.rm is FALSE, NA and NaN values in any of the arguments will cause NA values to be returned, otherwise NA values are ignored."

"If finite is TRUE, the minimum and maximum of all finite values is computed, i.e., finite = TRUE includes na.rm = TRUE."

References

Chinyere Onwubiko, An Introduction to Engineering, Mission, Kansas: Schroff Development Corporation, 1997, page 176.

See Also

sgm for geometric mean, shm for harmonic mean, cv for coefficient of variation (CV), rms for root-mean-square (RMS), relerror for relative error, and approxerror for approximate error.

Examples

Run this code
# NOT RUN {
library("iemisc")
require(stats)
set.seed(100) # makes the example reproducible
x <- rnorm(100)
ranges(x)



# }

Run the code above in your browser using DataCamp Workspace