yearqtr {zoo} | R Documentation |
"yearqtr"
is a class for representing quaterly data.
yearqtr(x)
x |
numeric (interpreted as being “in years”). |
The yearqtr class is used to represent quaterly data. Internally it holds
the data as year plus 0 for Quarter 1, 1/4 for Quarter 2
and so on in order that its internal representation is the same as
ts
class with frequency = 4
. If x
is not in this
format it is rounded via floor(4*x + .0001)/4
.
There are coercion methods available for various classes including:
default coercion to "yearqtr"
(which coerces to "numeric"
first)
and coercion from "yearqtr"
to "Date"
(see below), "POSIXct"
,
"POSIXlt"
, "numeric"
, "character"
.
Returns its argument converted to class yearqtr
.
x <- yearqtr(2000 + seq(0, 7)/4) 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(8), x, frequency = 4) z as.ts(z)