Returns a function that converts a continuous numeric vector into an integer vector with discrete levels.
equal_discrete(nlevels)
number of levels to split continuous vector into
function that makes a numeric vector discrete
# test data
x <- 1:10
# create and apply function to split x into 2 discrete levels
split_2 <- equal_discrete(2)
split_2(x)
#> [1] 1 1 1 1 1 2 2 2 2 2
# create and apply function to split x into 5 discrete levels
split_5 <- equal_discrete(5)
split_5(x)
#> [1] 1 1 2 2 3 3 4 4 5 5