Tests if a number or vector is in the interval [0,1]

is.in.01(x, exclude0 = FALSE)

Arguments

x

a number or vector or matrix

exclude0

TRUE is 0 is excluded, FALSE otherwise (default)

Value

a logical of the same size as x

Examples

is.in.01(-5)
#> [1] FALSE
is.in.01(0)
#> [1] TRUE
is.in.01(1)
#> [1] TRUE
is.in.01(0, exclude0 = TRUE)
#> [1] FALSE
is.in.01(2.5)
#> [1] FALSE
is.in.01(matrix(5:13/10, nrow=3))
#>      [,1] [,2]  [,3]
#> [1,] TRUE TRUE FALSE
#> [2,] TRUE TRUE FALSE
#> [3,] TRUE TRUE FALSE