histogram: Create a Histogram

Description Usage Arguments Examples

View source: R/histogram.R

Description

Functional wrapper to hist() in graphics. Adds functionality (frequency table) and standard cut options (right=FALSE) to hist().

Usage

1
2
3
4
5
6
7
8
9
histogram(
  x,
  breaks = NULL,
  table = FALSE,
  right = FALSE,
  xlab = deparse(substitute(x)),
  title = NULL,
  ...
)

Arguments

x

Variable to be plotted.

breaks

one of:

  • a vector giving the breakpoints between histogram cells,

  • a function to compute the vector of breakpoints,

  • a single number giving the number of cells for the histogram,

  • a character string naming an algorithm to compute the number of cells,

  • a function to compute the number of cells.

table

Logical: Should a frequency distribution table be produced?

right

Logical; if FALSE, the histogram cells are left-closed (right open) intervals.

xlab

Label of the x-axis. Default is the object name of x above.

title

Title (optional) of the chart.

...

Further arguments passed to or from other methods.

Examples

1
2
3
histogram(mtcars$hp)
histogram(mtcars$hp, breaks=seq(50, 350, by=25))
histogram(mtcars$hp, breaks=seq(50, 350, by=25), table=TRUE)

MichaelJMahometa/SDSRegressionR documentation built on March 3, 2021, 10:51 p.m.