Learn R Programming

grattan (version 1.5.2.5)

prohibit_vector_recycling: Prohibit vector recycling

Description

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

Usage

prohibit_vector_recycling(...)

Arguments

...

A list of vectors

Value

An error message if the vectors are of different length (unless the alternative length is 1).

Examples

Run this code
# 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))
# }

Run the code above in your browser using DataLab