thresh {eeptools}R Documentation

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?

Details

Calculates the proportion of a numeric vector reached after sorting the vector in ascending order and stopping at the specified count

Value

A numeric proportion

Author(s)

Jared E. Knowles

See Also

cutoff which this function is related to

Examples

# for vector
a <- rnorm(100, mean=6, sd=1)
thresh(a, 8) #return minimum number of elements to account 70 percent of total

[Package eeptools version 1.2.5 Index]