Learn R Programming

rapport (version 0.3)

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, size = 30L, ...)

Arguments

x
a character vector to test names
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
check.name("foo")               # [1] TRUE
check.name("foo.bar")           # [1] TRUE
check.name("foo_bar")           # [1] TRUE
check.name("foo.bar.234")       # [1] TRUE
check.name("foo.bar.234_asdf")  # [1] TRUE
check.name("234.asdf")          # [1] FALSE
check.name("_asdf")             # [1] FALSE
check.name(".foo")              # [1] FALSE

Run the code above in your browser using DataLab