A few additional functions to facilitate filtering of vectors

drop_zeros(x)

positives(x)

negatives(x)

integers(x)

Arguments

x

vector of numerics to be filtered

Examples

x <- seq(-3, 3, 0.5) drop_zeros(x)
#> [1] -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.5 1.0 1.5 2.0 2.5 3.0
positives(x)
#> [1] 0.5 1.0 1.5 2.0 2.5 3.0
negatives(x)
#> [1] -3.0 -2.5 -2.0 -1.5 -1.0 -0.5
integers(x)
#> [1] -3 -2 -1 0 1 2 3