Convert a numeric variable in to a factor with four levels.

convert.to.factor(x)

Arguments

x

a numeric vector

Value

a factor variable

Author

Tom Elliott

Examples

f <- convert.to.factor(runif(100, 0, 10))
levels(f)
#> [1] "[0 - 3]"  "(3 - 5]"  "(5 - 7]"  "(7 - 10]"