The function FUN
is applied to f
in bins specified by
xbreaks
and ybreaks
.
binApply2D(x, y, f, xbreaks, ybreaks, FUN, include.lowest = FALSE, ...)
A list with the following elements:
xbreaks
and ybreaks
as used, mid-points
xmids
and ymids
, and result
, a matrix containing the
result of applying FUN()
to the f
values
in the designated bins.
a vector of numerical values.
a vector of numerical values.
a vector of data to which FUN
will be applied.
values of x
at the boundaries between the
bins; calculated using pretty()
if not supplied.
as xbreaks
, but for y
.
function that is applied to the f
values
in each (x,y) bin. This must take two numeric vectors
as input, and return a single numeric value.
logical value indicating whether to include
x
values that equal xbreaks[1]
and y
values that equal
ybreaks[1]
. See “Details”.
optional arguments to pass to FUN
.
Dan Kelley
The division into bins is done with cut()
, to which include.lowest
is passed. By default, the x
bins are open at the left and closed
on the right, and the y
bins are open at the bottom and closed
at the top. However, if include.lowest
is TRUE, then those
boundary points are included in the calculation.
Other bin-related functions:
binApply1D()
,
binAverage()
,
binCount1D()
,
binCount2D()
,
binMean1D()
,
binMean2D()