cutoff: A function to calculate thresholds of cumulative sums in a...

Description Usage Arguments Details Value Author(s) Examples

View source: R/cutoff.R

Description

This function tells us how far we have to go before reaching a cutoff in a variable by sorting the vector, then finding how far to go. Note that the cutoff is expressed in percentage terms (fixed cumulative sum)

Usage

1
cutoff(x, cutoff, na.rm = TRUE)

Arguments

x

a numeric vector, missing values are allowed

cutoff

a user defined numeric value to stop the cutoff specified as a proportion 0 to 1

na.rm

logical, should missing values be excluded?

Details

Calculates the distance through a numeric vector before a certain proportion of the sum is reached by sorting the vector and calculating the cumulative proportion of each element

Value

An integer for the minimum number of elements necessary to reach cutoff

Author(s)

Jared E. Knowles

Examples

1
2
3
# for vector
a <- rnorm(100, mean=6, sd=1)
cutoff(a, .7) #return minimum number of elements to account 70 percent of total

eeptools documentation built on May 3, 2020, 1:05 a.m.