1

I have created an equal area histogram using histogram() in the Lattice, however, I can't seem to find a way to extract the values in the 20 equal are sized bins. Any suggestions? I've also looked into using ggplot2, but I can't create equal area sized bins while having the capability of extracting the data using ggplot_build. Here's an example:

library(lattice)

cell <- 1:20

psi <- rnorm(1:20)

histogram(df$psi,
          freq = TRUE,
          equal.width = FALSE,
          breaks = NULL,
          nint = 20)

Equal Area Histogram

As you can see in the figure, an equal area histogram is generated, but now I'd like to know which values from df$psi are within each bin of the histogram. I've tried assigning the plot to a new variable dfhist <- hist() and then inspecting the new variable dfhist$ yet it doesn't appear as though the results for each bin are stored anywhere. Thanks for your time.

Matt
  • 107
  • 8
  • Including a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) in your question will increase your chances of getting an answer. – Samuel Nov 10 '17 at 19:41

0 Answers0