Learn R Programming

TauStar (version 1.1.8)

isDiscrete: Heuristic check for discrete numeric data

Description

Assumes x is numeric, length(x) >= 4, and all values are finite and non-missing.

Usage

isDiscrete(
  x,
  tol = sqrt(.Machine$double.eps),
  unique_ratio = 0.2,
  max_levels = 10
)

Value

TRUE/FALSE best-guess.

Arguments

x

Numeric vector.

tol

Relative tolerance for "integer-like" checks.

unique_ratio

Max ratio of unique values to n to still consider discrete (must be < 1).

max_levels

Max absolute number of unique values to still consider discrete.

Details

Uses integer-within-tolerance and low unique-to-n with repetition (via unique ratio).