Skip to contents

probabilistic removal of elements from x. For each element, the probability to be preserved is independent and specified by prob

Usage

prob_remove(x, prob)

Arguments

x

vector

prob

number between 0 and 1, probability to preserve elements

Value

a vector of the same type as x

See also

Examples

x = prob_remove(1:10, 0.5)
x
#> [1]  4  5  7  8  9 10
x = prob_remove(1:10, 0.5)
x
#> [1] 1 3 4 5