thresh: A function to return the maximum percentage of the cumulative sum represented
by a subset of the vector
Description
Returns the proportion of the cumulative sum represented by the
number of elements in the vector a user specifies. This allows the user to
identify the maximum proportion of the total that only X number of elements
may represent in the vector.
Usage
thresh(x, cutoff, na.rm = TRUE)
Arguments
x
a numeric vector, missing values are allowed
cutoff
numeric, the number of elements to look at
na.rm
logical, should missing values be excluded?
Value
A numeric proportion
Details
Calculates the proportion of a numeric vector reached after sorting
the vector in ascending order and stopping at the specified count