predicate-utils: Utility Predicates

predicate-utilsR Documentation

Utility Predicates

Description

  • is_empty() checks is an object is empty (any zero-length dimensions).

  • has_length() checks how long is an object.

  • has_names() checks if an object is named.

  • has_duplicates() checks if an object has duplicated elements.

  • has_missing() and has_infinite() check if an object contains missing or infinite values.

Usage

has_length(x, n = NULL)

has_names(x, names = NULL)

has_duplicates(x)

has_missing(x)

has_infinite(x)

is_empty(x)

is_unique(x, na.rm = FALSE)

Arguments

x

A vector to be tested.

n

A length-one numeric vector specifying the length to test x with. If NULL, returns TRUE if x has length greater than zero, and FALSE otherwise.

names

A character vector specifying the names to test x with. If NULL, returns TRUE if x has names, and FALSE otherwise.

na.rm

A logical scalar: should missing values (including NaN) be omitted?

Value

A logical scalar.

See Also

Other predicates: predicate-matrix, predicate-numeric, predicate-scalar, predicate-trend, predicate-type


arkhe documentation built on Nov. 17, 2023, 5:09 p.m.