A simple test intended to distinguish between discrete and continuous values for the purpose of choosing analytics visualization selection. The selection of a cutoff value is purely subjective.

is_discrete(x, cutoff = 100)

Arguments

x

a vector of numeric values

cutoff

maximum number of unique values in x before x is considered not discrete

Value

logical

Examples

is_discrete(1:10)
#> [1] TRUE
is_discrete(runif(1000))
#> [1] FALSE