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, include.lowest = FALSE)
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.
vectors of numerical values.
vector of values of x
and y
at the boundaries between the 2D bins, calculated using
pretty()
on each of x
and y
, if not supplied.
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
.
logical value indicating whether to include
points where x
equals xbreaks[1]
or y
equals ybreaks[1]
.
Dan Kelley
By default, the sub-intervals defined by xbreaks
and ybreaks
are open on the left/bottom and closed on the right/top, to match
the behaviour of cut()
. An open interval does not include
points on the boundary, and so any x
and y
values that equal
xbreaks[1]
or ybreaks[1]
will not be counted. To include
such points in the calculation, set include.lowest
to TRUE.
Other bin-related functions:
binApply1D()
,
binApply2D()
,
binAverage()
,
binCount1D()
,
binMean1D()
,
binMean2D()