% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/quantile_pts.R
\name{quantile_pts}
\alias{quantile_pts}
\title{Quantile-based cut points for coplots}
\usage{
quantile_pts(object, groups, intervals = FALSE)
}
\arguments{
\item{object}{Numeric vector of predictor values.}

\item{groups}{Number of quantile points (or intervals) to compute.}

\item{intervals}{Logical indicating whether to return interval boundaries
suitable for \code{cut()} (length \code{groups + 1}) or the interior
quantile points (length \code{groups}).}
}
\value{
Numeric vector of quantile points. When \code{intervals = TRUE}
  the result is strictly increasing and can be supplied to \code{cut()} to
  produce \code{groups} balanced strata.
}
\description{
This helper wraps \code{\link[stats]{quantile}} to create well-spaced
cut points for conditioning plots. When \code{intervals = TRUE} the lower
boundary is nudged down so that \code{cut()} treats the minimum value as a
valid observation.

The output can be passed directly into the breaks argument of the
\code{cut} function for creating groups for coplots.
}
\examples{
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)

}
\seealso{
\code{cut}
}
