prohibit_vector_recycling: Prohibit vector recycling

View source: R/prohibit_vector_recycling.R

prohibit_vector_recyclingR Documentation

Prohibit vector recycling

Description

Tests (harshly) whether the vectors can be recycled safely.

Usage

prohibit_vector_recycling(...)

prohibit_vector_recycling.MAXLENGTH(...)

Arguments

...

A list of vectors

Value

An error message if the vectors are of different length (unless the alternative length is 1). The functions differ in their return values on success: prohibit_vector_recycling.MAXLENGTH returns the maximum of the lengths whereas prohibit_vector_recyling returns NULL. (Both functions return their values invisibly.)

Examples

## Not run: 
# Returns nothing because they are of the same length
prohibit_vector_recycling(c(2, 2), c(2, 2))
# Returns nothing also, because the only different length is 1
prohibit_vector_recycling(c(2, 2), 1)
# Returns an error:
prohibit_vector_recycling(c(2, 2), 1, c(3, 3, 3))

## End(Not run)

hutils documentation built on April 13, 2022, 5:23 p.m.