rebindensity {cooltools}R Documentation

Re-bin density histograms

Description

Transform density histogram data into histogram data with different bins

Usage

rebindensity(x, y, xout)

Arguments

x

n-vector giving the mid-points of the input histogram bins, must be equally spaced

y

n-vector giving the values of the input histogram values

xout

m-vector giving the mid-points of the output histogram bins, must be equally spaced

Value

m-vector of y-values associated with the bins specified by xout.

Author(s)

Danail Obreschkow

Examples

# original binning
x = seq(0.5,4.5)
y = seq(5)
plot(x,y,xlim=c(-1,6),ylim=c(0,6),pch=16)
lines(histcoord(x,y),lwd=3)

# rebinning
xout = seq(-0.9,6,0.3)
yout = rebindensity(x,y,xout)
points(xout,yout,col='red',pch=16)
lines(histcoord(xout,yout),col='red')


[Package cooltools version 2.4 Index]