Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bin1

univariate binning


Description

Function to compute array of bin counts for a data vector

Usage

bin1(x, ab, nbin=50)

Arguments

x

(input) data vector

ab

(input vector of length 2): half-open interval for bins [a,b). If no value is specified, the range of x is stretched by 5% at each end and used the interval.

nbin

(input integer): number of bins desired. Default 50.

Value

bin1 returns a list including the vector of integer bin counts and the ab vector and the number of points outside the ab interval.

See Also

Examples

x <- rnorm(100)         # data vector
ab <- c(-5,5)           # bin interval
bins <- bin1(x,ab,10)     # bin x into 10 bins over ab

ash

David Scott's ASH Routines

v1.0-15
GPL (>= 2)
Authors
S original by David W. Scott R port by Albrecht Gebhardt <albrecht.gebhardt@aau.at> adopted to recent S-PLUS by Stephen Kaluzny <spk@insightful.com>
Initial release
2015-08-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.