Learn R Programming

tsforecast (version 1.3.0)

tshistogram: Histograms

Description

Produce a histogram of a given univariate time series.

Usage

tshistogram(
  x,
  bins = NULL,
  density = FALSE,
  density.lwidth = 0.7,
  title = NULL,
  x.name = NULL,
  x.col = "darkgrey",
  density.col = "steelblue4"
)

Value

A histogram of x will be displayed with no further values or objects returned.

Arguments

x

a univariate time series object or a numeric vector or matrix.

bins

a numeric value to specify the number of bins in the histogram. Can be omitted. Default is NULL.

density

logical. Indicate whether the density curve of the normal distribution should be included. Default is FALSE.

density.lwidth

line width of the density curve in the output plot. Will be ignored if density = FALSE. Default is 0.7.

title

title of the histogram. Default is NULL.

x.name

name of the series. If omitted here, the series name found by tsname() will be taken over here. If tsname() is NULL, the variable name will be used instead. Default is NULL.

x.col

colour of the histogram bars. Default is `darkgrey`.

density.col

colour of the density curve. Will be ignored if density = FALSE. Default is `steelblue4`.

Author

Ka Yui Karl Wu

References

Venables, W. N., & Ripley. B. D. (2002) Modern Applied Statistics with S. Springer.

Examples

Run this code
tshistogram(airport$Travellers, density = TRUE)

Run the code above in your browser using DataLab