AvgToBin: Average a vector into bins

Description Usage Arguments Value Author(s)

View source: R/AvgToBin.R

Description

Averages y into bins according to the positon of a in the breaks Either give N=number of breaks, or N+1 breaks Breaks are defined as x>breaks[i], and x<=breaks[i+1] if fill=T, fill empty bins using linear interpolation from the neighbours to the center of the bin could be considerably speeded up by using cut ?cut

Usage

1
AvgToBin(x, y, N = NULL, breaks = pretty(x, N), bFill = FALSE)

Arguments

x

vector of x values

y

vector of y values, same length as x

N

Number of breaks (or NULL if breaks are supplied)

breaks

vector of breaks (optional, instead if N)

bFill

if TRUE fill empty bins using linear interpolation from the neighbours to the center of the bin

Value

list(breaks,centers,avg,nobs) Returns the breaks, centers, the averaged values and nobs, the number of observations averages

Author(s)

Thomas Laepple


EarthSystemDiagnostics/corit documentation built on May 29, 2019, 1:39 p.m.