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)
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.