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

bin2

2D binning


Description

Bin bivariate data x

Usage

bin2(x, ab, nbin)

Arguments

x

(input matrix with 2 columns) data sample

ab

(input 2 x 2 matrix) rows 1 and 2 contain x and y axis bin intervals, respectively. If not specified, the ranges are stretched by 5% at each end for each dimension.

nbin

(input vector of length 2) number of bins along x and y axes. Default is 20 by 20.

Value

bin2 returns a list including the bivariate bin matrix and the number of points outside the ab rectangle.

See Also

Examples

x <- matrix( rnorm(200), 100 , 2)       # bivariate normal n=100
ab <- matrix( c(-5,-5,5,5), 2, 2)       # interval [-5,5) x [-5,5)
nbin <- c( 20, 20)                      # 400 bins
bins <- bin2(x, ab, nbin)               # bin counts,ab,nskip

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.