Count the number of elements of a given matrix z=z(x,y) that fall within successive pairs of breaks in x and y.

binCount2D(x, y, xbreaks, ybreaks, flatten = FALSE)

Arguments

x

vector of numerical values.

y

vector of numerical values.

xbreaks

Vector of values of x at the boundaries between bins, calculated using [pretty``](x)` if not supplied.

ybreaks

Vector of values of y at the boundaries between bins, calculated using pretty(y) if not supplied.

flatten

A logical value indicating whether the return value also contains equilength vectors x, y, z and n, a flattened representation of xmids, ymids, result and number.

Value

A list with the following elements: the breaks (xbreaks and ybreaks), the midpoints (xmids and ymids) between those breaks, and the count (number) of f values in the boxes defined between successive breaks.

See also

Other bin-related functions: binApply1D(), binApply2D(), binAverage(), binCount1D(), binMean1D(), binMean2D()