Learn R Programming

posterior (version 1.6.0)

rvar_is_finite: Special value predicates for random variables

Description

Compute special value predicates (checking for finite / infinite values, NaN, and NA) on all draws within a random variable, returning a random variable.

Usage

rvar_is_finite(x)

rvar_is_infinite(x)

rvar_is_nan(x)

rvar_is_na(x)

Value

A logical rvar of the same length as the input.

Arguments

x

(rvar) An rvar.

Details

These functions return a new rvar that is the result of applying is.finite(), is.infinite(), is.nan(), or is.na() to every draw in the input random variable.

See Also

rvar-summaries-over-draws for summary functions across draws, including implementations of is.finite(), is.infinite(), is.nan(), and is.na() for rvars.

Other rvar-summaries: rvar-summaries-over-draws, rvar-summaries-within-draws

Examples

Run this code

x <- rvar(c(1, Inf, -Inf, NaN, NA))
x

rvar_is_finite(x)
rvar_is_infinite(x)
rvar_is_nan(x)
rvar_is_na(x)

Run the code above in your browser using DataLab