check_functions {sits}R Documentation

Auxiliary check functions

Description

Functions to check parameters from a specific type, for example, for .check_chr functions the check is exclusive for character type.

Usage

.check_that(x, ..., local_msg = NULL, msg = NULL)

.check_null(x, ..., allow_null = FALSE, msg = NULL)

.check_na(x, ..., allow_na = FALSE, msg = NULL)

.check_names(x, ..., is_named = TRUE, msg = NULL)

.check_length(x, ..., len_min = 0, len_max = 2^31, msg = NULL)

.check_apply(x, fn_check, ..., msg = NULL)

.check_lgl_type(x, ..., msg = NULL)

.check_num_type(x, ..., msg = NULL)

.check_int_type(x, ..., msg = NULL)

.check_num_range(x, ..., min = -Inf, max = Inf, allow_zero = TRUE, msg = NULL)

.check_chr_type(x, ..., msg = NULL)

.check_chr_empty(x, ..., msg = NULL)

.check_chr_choices(x, choices, ..., msg = NULL)

.check_lst_type(x, ..., msg = NULL)

.check_lgl(
  x,
  ...,
  allow_na = FALSE,
  len_min = 0,
  len_max = 2^31,
  allow_null = FALSE,
  is_named = FALSE,
  msg = NULL
)

.check_num(
  x,
  ...,
  allow_na = FALSE,
  min = -Inf,
  max = Inf,
  allow_zero = TRUE,
  len_min = 0,
  len_max = 2^31,
  allow_null = FALSE,
  is_integer = FALSE,
  is_named = FALSE,
  msg = NULL
)

.check_chr(
  x,
  ...,
  allow_na = FALSE,
  allow_empty = TRUE,
  choices = NULL,
  len_min = 0,
  len_max = 2^31,
  allow_null = FALSE,
  is_named = FALSE,
  msg = NULL
)

.check_lst(
  x,
  ...,
  min_len = 0,
  max_len = 2^31,
  allow_null = FALSE,
  is_named = TRUE,
  fn_check = NULL,
  msg = NULL
)

.check_file(x, ..., msg = NULL)

.check_warn(expr)

Arguments

x

A object that will be check. That can be a numeric or character vectors or a list.

...

Additional parameters for fn_check function.

local_msg

A character with the generic error message that will show to the user.

msg

A character with the error message that will show to the user.

allow_null

A logical indicating if the check permits empty NULL values. Default is FALSE.

allow_na

A logical indicating if the check permits empty NA values. Default is FALSE.

is_named

A logical indicating if the check permits unnamed list.

len_min

A numeric indicating the minimum length of vector or list users provides for functions. Default is 0.

len_max

A numeric indicating the maximum length of vector or list users provides for functions. Default is 2^31.

fn_check

A function used to test the object elements.

min

A atomic vector of numeric indicating the minimum value that the user can provide in function parameter. Only works for numeric check. By default is -Inf.

max

A atomic vector of numeric indicating the maximum value that the user can provide in function parameter. Only works for numeric check. By default is Inf.

allow_zero

A logical indicating if the check permits zero values. Default is TRUE.

choices

A atomic vector of characters indicating the choices of user can provide in function parameter. Only works for character check.

is_integer

A logical indicating if the value must be integer.

allow_empty

A logical indicating if the check permits empty list. Default is TRUE.

min_len

A numeric indicating the minimum length of vector or list users provides for functions. Default is 0.

max_len

A numeric indicating the maximum length of vector or list users provides for functions. Default is 2^31.

expr

A expression to be evaluated.


[Package sits version 0.13.0 Index]