Learn R Programming

unfoldr (version 0.2)

binning1d: Binning numeric values

Description

Vector of count data

Usage

binning1d(x, bin, na.rm = FALSE)

Arguments

x
numeric values to be binned
bin
non-decreasingly sorted breaks vector
na.rm
logical, removing missing values (including NaN) in the argument x?

Value

  • Vector of count data

Details

This function provides basic binning (grouping) of numeric values into classes defined by the breaks vector bin. The values are binned according to bin[i[j]]$<$x[j]$\leq$ bin[i[j]+1]="" for="" interval="" i="1,...,N-1" length(bin)=N and value x[j]. If x[j] > bin[N] or x[j] < bin[1] then x[j] is not counted at all.

Examples

Run this code
x <- runif(100,0,1)
	bin <- seq(0,1,by=0.1)
	binning1d(x,bin)

Run the code above in your browser using DataLab