check_length: Check the length of an input to a parent function

View source: R/utils.R

check_lengthR Documentation

Check the length of an input to a parent function

Description

This function checks that the length of an input to a parent function is correct. If not, the function returns a helpful error message.

Usage

check_length(
  arg = deparse(substitute(input)),
  input,
  req_length,
  req_arg = deparse(substitute(req_length))
)

Arguments

arg

(optional) A character string which defines the argument of a parent function.

input

An object.

req_length

A number which defines the required length of input.

req_arg

A character which defines the name of the object which defines the required length.

Value

The function returns a helpful error message for unnamed lists (ignoring empty lists if requested) or the inputted list unchanged.

Author(s)

Edward Lavender


edwardlavender/fvcom.tbx documentation built on Nov. 26, 2022, 10:28 p.m.