check-scalar-hasElements: Does the input have elements?

check-scalar-hasElementsR Documentation

Does the input have elements?

Description

Does the input have elements?

Usage

hasElements(x, n = NULL)

nElements(x)

Arguments

x

Object.

n

integer(1). Number to include.

Value

TRUE on success; FALSE on failure, with cause set.

Functions

  • nElements(): Return the number of elements in object.

Note

Updated 2023-09-29.

See Also

  • prod(), which returns the product of all values in its arguments. This is called internally to check the number of elements.

  • assertive.properties::has_elements().

  • assertive.properties::is_of_dimension().

  • assertive.properties:::n_elements().

Examples

## TRUE ====
hasElements("hello")
hasElements("hello", n = 1)
hasElements(list(a = 1, b = 2), n = 2)

## FALSE ====
hasElements(NULL)
hasElements(list(), n = 1)

acidgenomics/r-goalie documentation built on Jan. 12, 2024, 4:15 a.m.