Skip to contents

Are these valid names?

Usage

validNames(x)

Arguments

x

Object.

Value

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

Note

Updated 2023-09-29.

See also

Examples

## TRUE ====
## Dots (periods) and underscores are valid.
validNames(c("sample.1", "sample_1"))
#> [1] TRUE

## FALSE ====
## Can't begin with a number.
validNames("293cells")
#> [1] FALSE
## Cannot contain duplicates.
validNames(c("a", "a"))
#> [1] FALSE
## Spaces, dashes (hyphens), and other non-alphanumerics aren't valid.
validNames("sample 1")
#> [1] FALSE
validNames("cell-AAAAAAAA")
#> [1] FALSE
validNames("GFP+")
#> [1] FALSE