Last chance! 50% off unlimited learning
Sale ends in
"yearqtr"
is a class for representing quarterly data.yearqtr(x)
yearqtr
.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"
.yearmon
, zoo
, zooreg
, ts
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)
Run the code above in your browser using DataLab