checkVectLength: Check length of vector

View source: R/checkVectLength.R

checkVectLengthR Documentation

Check length of vector

Description

checkVectLength checks argument 'x' for expected length 'expeL' and return either message or error when expectation not met. May be used for parameter ('sanity') checking in other user front-end functions.

Usage

checkVectLength(
  x,
  expeL = 1,
  stopOnProblem = FALSE,
  silent = FALSE,
  debug = FALSE,
  callFrom = NULL
)

Arguments

x

(numeric or charcter vector) input to check length

expeL

(numeric) expected length

stopOnProblem

(logical) continue on problems with message or stop (as error message)

silent

(logical) suppress messages

debug

(logical) display additional messages for debugging

callFrom

(character) allow easier tracking of message(s) produced

Value

This function returns NULL; it produces either error-message if length is not OK or optional message if length is OK

Examples

aa <- 1:5; checkVectLength(aa,exp=3)

wrMisc documentation built on Nov. 17, 2023, 5:09 p.m.