binningfunctions: Different functions that perform binning.

Description Usage Arguments Value Examples

Description

Different functions that perform binning.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cut_at(breaks)

nearest(centers)

bin_by_ntile(nbins)

bin_by_eqcut(nbins)

bin_by_pam(nbins)

bin_by_classInt(style, nbins = NULL)

Arguments

breaks

A numeric vector of values that designate cut points between bins.

centers

A numeric vector of values that designate the center of each bin.

nbins

The number of bins to split the data into.

style

a binning style (see ?classInt::classIntervals for details).

Value

Each of these functions returns a function of a single numeric vector 'x' that assigns each value of 'x' to a bin.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
x <- c(rnorm(10, 1, 1), rnorm(10, 3, 2), rnorm(20, 5, 3))
centers <- c(1, 3, 5)
nearest(centers)(x)

breaks <- c(2, 4)
cut_at(breaks)(x)

bin_by_eqcut(nbins=4)(x)
bin_by_ntile(nbins=4)(x)

## Not run: 
bin_by_pam(nbins=4)(x)
bin_by_classInt("pretty", nbins=4)(x)

## End(Not run)

smouksassi/ComputePI documentation built on Nov. 10, 2019, 2:46 p.m.