Learn R Programming

rapport (version 0.40)

check.name: Naming Conventions

Description

Checks package-specific naming conventions: variables should start by a letter, followed either by a letter or a digit, while the words should be separated with dots or underscores.

Usage

check.name(x, min.size = 1L, max.size = 30L, ...)

Arguments

x
a character vector to test names
min.size
an integer value that indicates minimum name length
max.size
an integer value that indicates maximum name length
...
additional arguments to be passed to grepl function

Value

  • a logical vector indicating which values satisfy the naming conventions

Examples

Run this code
rapport:::check.name("foo")               # [1] TRUE
rapport:::check.name("foo.bar")           # [1] TRUE
rapport:::check.name("foo_bar")           # [1] TRUE
rapport:::check.name("foo.bar.234")       # [1] TRUE
rapport:::check.name("foo.bar.234_asdf")  # [1] TRUE
rapport:::check.name("234.asdf")          # [1] FALSE
rapport:::check.name("_asdf")             # [1] FALSE
rapport:::check.name(".foo")              # [1] FALSE

Run the code above in your browser using DataLab