Generalized Histogram Computation with classes to contain a single histogram or multiple histograms

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |

`data` |
a vector of values for which the histogram is desired. |

`n` |
a single number giving the number of bins for the histogram. |

`breaks` |
a vector giving the breakpoints between histogram bins, or
a character string naming an algorithm to compute the number of bins, or
a function to compute the number of bins (see |

`bins` |
character vecter, the bin labels. |

`digits` |
integer, the number of digits to round for breaks. |

`x` |
an R object. |

`h` |
an object of class |

`ghist`

generates a single histogram.

`gbreaks`

generate bin boundaries for a histogram.

`is.ghist`

returns `TRUE`

if `x`

is an object of codeghist and
`FALSE`

otherwise.

`as.ghist`

is a generic function. The method for numeric vectors will return a
`ghist`

object.

`is.mhist`

returns `TRUE`

if `x`

is an object of codemhist and
`FALSE`

otherwise.

`as.mhist`

is a generic function. The method is for numeric list, matrices or data frames and will return a
`mhist`

object.

`mhist2matrix`

convert a `mhist`

object into a numeric matrix, filling observations by row.

`plot.mhist`

`mhist.summary`

`plot.mhist.summary`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
## load library
require("GMD")
## create two normally-distributed samples
## with unequal means and unequal variances
set.seed(2012)
v1 <- rnorm(1000,mean=-5, sd=10)
v2 <- rnorm(1000,mean=10, sd=5)
## create common bins
n <- 20 # desired number of bins
breaks <- gbreaks(c(v1,v2),n) # bin boundaries
x <-
list(ghist(v1,breaks=breaks,digits=0),
ghist(v2,breaks=breaks,digits=0))
mhist.obj <- as.mhist(x)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.