data(Boston, package="MASS")
rfsrc_boston <- randomForestSRC::rfsrc(medv~., Boston)
# To create 6 intervals, we want 7 points.
# quantile_pts will find balanced intervals
rm_pts <- quantile_pts(rfsrc_boston$xvar$rm, groups=6, intervals=TRUE)
# Use cut to create the intervals
rm_grp <- cut(rfsrc_boston$xvar$rm, breaks=rm_pts)
summary(rm_grp)
Run the code above in your browser using DataLab