require(Hmisc)
# Matrix
x <- c(1:10)
x <- cbind(x, x)
breaks <- list(c(1, 2, 4, 8, 10), c(1, 5, 10))
y <- cont2cat(x, breaks)
y
# Data frame
x <- c(1:10)
x <- data.frame(cbind(x, x))
breaks <- list(c(1, 2, 4, 8, 10), c(1, 5, 10))
y <- cont2cat(x, breaks)
y
# Vector
x <- c(1:10)
breaks <- c(1, 2, 4, 8, 10)
y <- cont2cat(x, breaks)
yRun the code above in your browser using DataLab