binning: Binning of single variables or data frames

Description Usage Arguments Value Author(s) See Also Examples

View source: R/binning.R

Description

Bins a single vector, a pair of vectors, a matrix or a data frame by equidistant or quantile based binning.

Usage

1
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.

Author(s)

Katrin Grimm

See Also

binningplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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)

## End(Not run)

mbgraphic documentation built on May 2, 2019, 2:45 a.m.