binning: Binning of single variables or data frames
Description
Bins a single vector, a pair of vectors, a matrix or a data frame by equidistant or quantile based binning.
Usage
binning(x, y = NULL, b = 20, bin = "equi", anchor = "min")
Arguments
x
A numeric vector, a numeric matrix or a data frame. In case of a data frame only the numeric variables are used.
y
NULL (default) or a vector with same length as x.
b
A positive integer. Number of bins in each variable.
bin
A character string giving the binning method. "equi" (default) for equdistant binning or "quant" for quantile based binning.
anchor
A chraracter string or a numeric. How should the anchor point be chosen? "min" (default) for the minimum of each variable, "ggplot" for the method used in ggplot graphics, "nice" for a "pretty"" anchorpoint, or a user specified value.
Value
A data frame giving the mean of each bin and the numbers of counts.
# NOT RUN {df <- data.frame(
x = rnorm(1000),
y = rnorm(1000),
z = rnorm(1000))
# A common binning for all variables of df with 5 bins in each dimension:binning(df,b=5)
# }