x <- rvec(list(c(1.2, NA),
c(Inf, 3),
c(-1, NaN)))
## return a logical rvec
is.na(x)
is.nan(x)
is.finite(x)
is.infinite(x)
## return a logical rvec with length 1
anyNA(x)
## summarise across draws
draws_any(anyNA(x))
## return an NA-free version of 'x'
na.omit(x)
na.exclude(x)
## use 'if_else_rvec' to modify values
## within rvec
if_else_rvec(is.na(x), 999, x)
## vctrs functions
library(vctrs, warn.conflicts = FALSE)
## all draws missing
vec_detect_missing(x)
## any draws missing
vec_detect_complete(x)
Run the code above in your browser using DataLab