R/checks.R

Defines functions check_ctn_data check_discrete_data

## Non-export functions.
## Used for input checking

check_discrete_data = function(x) {
  if (!all(floor(x) == x))
    stop("Your data should be discrete.
          Either use `floor` or `round` on your data set. Or switch to a continuous distribution.")

  if (min(x) < 1)
    stop("Data should be strictly positive, i.e. no zeros.")
}

check_ctn_data = function(x) {
  if (min(x) <= 0)
    stop("Data should be strictly positive, i.e. no zeros.")
}

Try the poweRlaw package in your browser

Any scripts or data that you put into this service are public.

poweRlaw documentation built on April 25, 2020, 9:06 a.m.