percent_cutoff: Find percentage of numbers that are above given thresholds.

View source: R/simple_math.R

percent_cutoffR Documentation

Find percentage of numbers that are above given thresholds.

Description

Takes a numeric vector and a numeric vector of thresholds. Returns the percent of numbers in the first above each of the numbers in the second.

Usage

percent_cutoff(x, cutoffs = c(0.3, 0.5), digits = 2, below = F, inclusive = T)

Arguments

x

(num vector) A vector of numbers.

cutoffs

(num vector) A vector of thresholds. Default=(.30, .50)

digits

(num scalar) The number of digits to round output to. Default=2.

below

(log scalar) Whether to count values below the cutoff (default false).

inclusive

(log scalar) Whether to include values at the cutoff (default true).

Examples

percent_cutoff(iris$Sepal.Length, cutoffs = 4:8)
percent_cutoff(iris$Sepal.Length, cutoffs = 4:8, below = T) #reverse cutoff
percent_cutoff(c(1:3, NA, NaN, 4:6), cutoffs = 3) #ignores NA/NaN

Deleetdk/kirkegaard documentation built on April 22, 2024, 5:22 p.m.