rebindensity | R Documentation |
Transform density histogram data into histogram data with different bins
rebindensity(x, y, xout)
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 |
m-vector of y-values associated with the bins specified by xout.
Danail Obreschkow
# 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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.