Learn R Programming

assertive.base (version 0.0-9)

set_cause: Set a cause and return the input

Description

Sets the cause attribute of an object and returns that object.

Usage

set_cause(x, false_value, missing_value = "missing")

Arguments

x

A variable.

false_value

A character vector to set the cause to, where x is FALSE.

missing_value

A character vector to set the cause to, where x is NA.

Value

x, with a new cause attribute.

Details

If x is TRUE everywhere, this returns the input without setting a cause. Otherwise, the cause is an empty string where x is TRUE, false_value where it is FALSE, and missing_value where it is NA.

See Also

cause, setNames