check-scalar-hasLength: Does the input have a non-zero or defined length?

check-scalar-hasLengthR Documentation

Does the input have a non-zero or defined length?

Description

Does the input have a non-zero or defined length?

Usage

hasLength(x, n = NULL)

Arguments

x

Object.

n

NULL or integer. If NULL (default), the function will check to see if the input length is non-zero.

Value

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

Note

Updated 2023-09-29.

Examples

## TRUE ====
hasLength(1L)
hasLength(FALSE)
hasLength(datasets::mtcars)
hasLength("")

## FALSE ====
hasLength(NULL)
hasLength(character())
hasLength(data.frame())

steinbaugh/goalie documentation built on Jan. 17, 2024, 5:16 p.m.