yearmon

0th

Percentile

An Index Class for Monthly Data

"yearmon" is a class for representing monthly data.

Keywords
ts
Usage
yearmon(x)
Arguments
x
numeric (interpreted as being in years).
Details

The yearmon class is used to represent monthly data. Internally it holds the data as year plus 0 for January, 1/12 for February, 2/12 for March and so on in order that its internal representation is the same as ts class with frequency = 12. If x is not in this format it is rounded via floor(12*x + .0001)/12. There are coercion methods available for various classes including: default coercion to "yearmon" (which coerces to "numeric" first) and coercion from "yearmon" to "Date" (see below), "POSIXct", "POSIXlt", "numeric", "character".

Value

  • Returns its argument converted to class yearmon.

See Also

yearqtr, zoo, zooreg, ts

Aliases
  • yearmon
  • as.yearmon
  • as.yearmon.default
  • as.yearmon.numeric
  • as.yearmon.integer
  • as.yearmon.dates
  • as.yearmon.Date
  • as.yearmon.POSIXt
  • as.Date.yearmon
  • as.POSIXct.yearmon
  • as.POSIXlt.yearmon
  • as.numeric.yearmon
  • as.character.yearmon
  • c.yearmon
  • format.yearmon
  • print.yearmon
  • [.yearmon
  • axis.yearmon
  • MATCH.yearmon
  • Ops.yearmon
Examples
x <- yearmon(2000 + seq(0, 23)/12)
x

# returned Date is the fraction of the way through
# the period given by frac (= 0 by default)
as.Date(x)
as.Date(x, frac = 1)
as.POSIXct(x)

z <- zoo(rnorm(24), x, frequency = 12)
z
as.ts(z)
Documentation reproduced from package zoo, version 0.9-9, License: GPL

Community examples

Looks like there are no examples yet.