Count the number of elements of a given matrix z=z(x,y) that fall within successive pairs of breaks in x and y.
Arguments
- x, y
vectors of numerical values.
- xbreaks, ybreaks
vector of values of
x
andy
at the boundaries between the 2D bins, calculated usingpretty()
on each ofx
andy
, if not supplied.- flatten
A logical value indicating whether the return value also contains equilength vectors
x
,y
,z
andn
, a flattened representation ofxmids
,ymids
,result
andnumber
.- include.lowest
logical value indicating whether to include points where
x
equalsxbreaks[1]
ory
equalsybreaks[1]
.
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.
Details
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.
See also
Other bin-related functions:
binApply1D()
,
binApply2D()
,
binAverage()
,
binCount1D()
,
binMean1D()
,
binMean2D()