as_yearqtr {dint} | R Documentation |
Coerce to zoo yearqtr objects
Description
as_yearqtr()
and as_yearmon()
are included for interoperability with
zoo::yearqtr()
, an alternative year-quarter format that is based on a
decimal representation as opposed to dint's integer representation of
year-quarters. as_yearweek()
follows a similar idea, but there is no
corresponding S3 class in zoo. These functions were included
for cases where you need a continuous representation of date_xx
objects
other then base::Date()
(for example, they are used by scale_date_xx)
Usage
as_yearqtr(x)
## S3 method for class 'date_yq'
as_yearqtr(x)
## S3 method for class 'yearqtr'
as_yearqtr(x)
as_yearmon(x)
## S3 method for class 'date_ym'
as_yearmon(x)
## S3 method for class 'yearmon'
as_yearmon(x)
as_yearweek(x)
## S3 method for class 'date_yw'
as_yearweek(x)
## S3 method for class 'yearweek'
as_yearweek(x)
Arguments
x |
any R object |
Value
a zoo::yearqtr, zoo::yearmon or dint::yearweek
vector.
Examples
q <- date_yq(2016, 1:4)
as.numeric(q)
qzoo <- as_yearqtr(q)
as.numeric(qzoo)
m <- date_ym(2016, 1:12)
as.numeric(m)
mzoo <- as_yearmon(m)
as.numeric(mzoo)
w <- date_yw(2016, 1:52)
as.numeric(w)
wzoo <- as_yearweek(w)
as.numeric(wzoo)
[Package dint version 2.1.4 Index]