Learn R Programming

extras (version 0.7.3)

chk_pars: Check Parameter Names

Description

Checks if valid parameter names.

Usage

chk_pars(x, x_name = NULL)

vld_pars(x)

Value

The chk_ function throws an informative error if the test fails.

The vld_ function returns a flag indicating whether the test was met.

Arguments

x

An object.

x_name

A string of the name of object x or NULL.

Functions

  • vld_pars(): Validate Parameter Names

Details

The character vector must consist of values that start with an alpha and only include alphanumeric characters and '_' or '.'.

Missing values and duplicates are permitted.

Examples

Run this code
x <- c("x", "a1._", "X")
chk_pars(x)
y <- c("x[1]", "a1", "a1", "._0")
try(chk_pars(y))
vld_pars(c("x", "a1._", "X"))
vld_pars(c("x[1]", "a1", "a1", "._0"))

Run the code above in your browser using DataLab