zoo_to_ts {deseats}R Documentation

Time Series Object Conversion from "zoo" to "ts"

Description

Allows for the conversion of time series objects of class "zoo" to time series objects of class "ts". This is only suitable, if the time series is observed in regular time intervals (monthly, quarterly, yearly, etc.). The correct observation time points are then kept.

Usage

zoo_to_ts(xt)

Arguments

xt

a time series object of class "zoo" with equidistant observation time points (monthly, quarterly, yearly, etc.).

Details

An equidistant time series object of class "zoo" is transformed to class "ts". This is particularly useful, since most functions of this package work with objects of class "ts" only.

Value

An object of class "ts" is returned.

Examples

# Create example zoo-object
tp <- seq(from = as.Date("2020-01-01"), to = as.Date("2020-10-01"), by = "month")
xt <- zoo::zoo(1:10, order.by = tp)
xt

# Transform into ts-object
yt <- zoo_to_ts(xt)
yt


[Package deseats version 1.1.0 Index]