hist.POSIXt {base}R Documentation

Histogram of a Date-Time Object

Description

Method for hist applied to date-time objects.

Usage

## S3 method for class 'POSIXt':
hist(x, breaks, ..., plot = TRUE, freq = FALSE,
     start.on.monday = TRUE, format)

Arguments

x an object inheriting from class "POSIXt".
breaks a vector of cut points or number giving the number of intervals which x is to be cut into or an interval specification, one of "secs", "mins", "hours", "days", "weeks", "months" or "years".
... graphical parameters, or arguments to hist.default such as include.lowest, right and labels.
plot logical. If TRUE (default), a histogram is plotted, otherwise a list of breaks and counts is returned.
freq logical; if TRUE, the histogram graphic is a representation of frequencies, i.e, the counts component of the result; if FALSE, relative frequencies (“probabilities”) are plotted.
start.on.monday logical. If breaks = "weeks", should the week start on Mondays or Sundays?
format for the x-axis labels. See strptime.

Value

An object of class "histogram": see hist.

See Also

seq.POSIXt, axis.POSIXct, hist

Examples

hist(.leap.seconds, "years", freq = TRUE)
hist(.leap.seconds,
     seq(ISOdate(1970, 1, 10), ISOdate(2002, 1, 1), "5 years"))

## 100 random dates in a 10-week period
random.dates <- ISOdate(2001, 1, 1) + 70*86400*runif(100)
hist(random.dates, "weeks", format = "%d %b")

[Package Contents]