Learn R Programming

extras (version 0.7.3)

chk_index: Check Index

Description

Checks if an object is a vector of one or more positive integer values.

Usage

chk_index(x, x_name = NULL)

vld_index(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_index(): Validate Index

Examples

Run this code
x <- c(2L, 1L)
chk_index(x)
y <- c(2L, -1L)
try(chk_index(y))
vld_index(c(-1))
vld_index(c(3L, 1L))

Run the code above in your browser using DataLab