rebindensity: Re-bin density histograms

Description Usage Arguments Value Author(s) Examples

View source: R/rebindensity.R

Description

Transform density histogram data into histogram data with different bins

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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.125,4.875,0.25)
yout = rebindensity(x,y,xout)
points(xout,yout,col='red',pch=16)
lines(histcoord(xout,yout),col='red')

physx documentation built on Feb. 3, 2022, 5:08 p.m.

Related to rebindensity in physx...