assert_numeric_vector: Is an Argument a Numeric Vector?

Description Usage Arguments Value Author(s) Examples

View source: R/assertions.R

Description

Checks if an argument is a numeric vector

Usage

1
assert_numeric_vector(arg, optional = FALSE)

Arguments

arg

A function argument to be checked

optional

Is the checked parameter optional? If set to FALSE and arg is NULL then an error is thrown

Value

The function throws an error if arg is not a numeric vector. Otherwise, the input is returned invisibly.

Author(s)

Stefan Bundfuss

Examples

1
2
3
4
5
6
7
example_fun <- function(num) {
  assert_numeric_vector(num)
}

example_fun(1:10)

try(example_fun(letters))

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.