fail_if_NA: Fail if input contains NA

View source: R/error_handling.R

fail_if_NAR Documentation

Fail if input contains NA

Description

Inputs any object, checks if it contains NA. If yes, throws an error. If not, returns the input.

Usage

fail_if_NA(x, msg = "Input contained NA.")

Arguments

x

(any object) The object to test.

msg

(chr) An error message.

Value

Invisibly returns the input.

Examples

fail_if_NA(1:10) #no NAs
fail_if_NA(c(1:3, NA, 1:3)) #NAs

Deleetdk/kirkegaard documentation built on April 22, 2024, 5:22 p.m.