rvifelse is the rv-compatible version of the function
ifelse.
rvifelse(test, yes, no)an object which can be coerced to logical mode.
return values for true elements of test
return joint simulations and not simulations from each component separately
A numeric array of dimensions size times
length(x).
rvifelse returns a random value with the same shape as
test which is filled with random or constant elements selected from
either yes or no, depending on whether the random draw in an
element of test is TRUE or FALSE.
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv").