Learn R Programming

quickcode (version 1.0.6)

error.out: Error coalescing operator

Description

Alternative return for error statements.Return alternative if the value of expression is erroneous

Usage

error.out(test, alternative = "")

test %eo% alternative

Value

value of test if error, else return value of alternative

Arguments

test

an object to return

alternative

alternative object to return

Examples

Run this code
# The following statement would produce
# error because 'stat1' does not exist

# stat1 + 1

# To prevent the statement from
# stopping the process, when can have alternative out
alt = 0
error.out(stats1 + 1, alt)

Run the code above in your browser using DataLab