check-scalar-hasValidNames: Does the input object have syntactically valid names?

check-scalar-hasValidNamesR Documentation

Does the input object have syntactically valid names?

Description

Does the input object have syntactically valid names?

Usage

hasValidNames(x)

hasValidDimnames(x)

Arguments

x

Object.

Value

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

Note

Updated 2022-05-13.

See Also

validNames().

Examples

## TRUE ====
x <- list("a" = 1L, "b" = 2L)
print(names(x))
print(hasValidNames(x))

x <- datasets::iris
print(hasValidDimnames(x))

## FALSE ====
x <- list(
    "1" = 1, # can't start with number
    "foo bar" = 2, # no spaces
    "foo-bar" = 3 # no hyphens
)
print(x)
print(hasValidNames(x))

x <- datasets::mtcars
print(hasValidDimnames(x))

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