Learn R Programming

ggRandomForests (version 1.1.2)

quantile_cuts: Find the cut points of a vector, evenly distributed along the vectors values.

Description

This function finds the cut point values from a vector argument to produce groups intervals. Setting groups=2 will return three values, the two end points, and one mid point (at the median value of the vector).

The output can be passed directly into the breaks argument of the cut function for creating groups for coplots.

Usage

quantile_cuts(object, groups)

Arguments

object
vector to be cut
groups
how many groups do we want

Value

  • vector of groups+1 cut point values.

See Also

cut gg_partial_coplot

Examples

Run this code
data(rfsrc_Boston)

# To create 6 intervals, we want 7 points.
# quantile_cuts will find balanced intervals
rm_pts <- quantile_cuts(rfsrc_Boston$xvar$rm, groups=6)

# 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