The function FUN
is applied to f
in bins specified by
xbreaks
. The division of data into bins is done with cut()
.
binApply1D(x, f, xbreaks, FUN, include.lowest = FALSE, ...)
a vector of numerical values.
a vector of data to which FUN
will be applied.
optional vector holding values of x at the boundaries between bins.
If this is not given, it is computed by calling pretty()
with n=20 segments.
function that is applied to the f
values
in each x bin. This must take a single numeric vector
as input, and return a single numeric value.
logical value indicating whether to include
x
values that equal xbreaks[1]
. See “Details”.
optional arguments to pass to FUN
.
A list with the following elements: xbreaks
as
used, xmids
(the mid-points between those breaks) and
result
(the result of applying FUN
to the f
values
in the designated bins).
By default, the sub-intervals defined by the xbreaks
argument are open
on the left and closed on the right, to match the behaviour
of cut()
. An open interval does not include points on
the boundary, and so any x
values that exactly match
the first breaks
value will not be counted. To include
such points in the calculation, set include.lowest
to TRUE.
Other bin-related functions:
binApply2D()
,
binAverage()
,
binCount1D()
,
binCount2D()
,
binMean1D()
,
binMean2D()