thresh | R Documentation |
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.
thresh(x, cutoff, na.rm = TRUE)
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? |
Calculates the proportion of a numeric vector reached after sorting the vector in ascending order and stopping at the specified count
A numeric proportion
Jared E. Knowles
cutoff
which this function is related to
# for vector
a <- rnorm(100, mean=6, sd=1)
thresh(a, 8) #return minimum number of elements to account 70 percent of total
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.