xts_to_ts: Converting 'xts' object to 'ts' object

View source: R/util_functions.R

xts_to_tsR Documentation

Converting 'xts' object to 'ts' object

Description

Converting 'xts' object to 'ts' object

Usage

xts_to_ts(xts.obj, frequency = NULL, start = NULL)

Arguments

xts.obj

A univariate 'xts' object

frequency

A character, optional, if not NULL (default) set the frequency of the series

start

A Date or POSIXct/lt object, optional, can be used to set the starting date or time of the series

Examples


data(Michigan_CS)
class(Michigan_CS)
ts_plot(Michigan_CS)
Michigan_CS_ts <- xts_to_ts(Michigan_CS)
ts_plot(Michigan_CS_ts)


# Defining the frequency and starting date of the series
Michigan_CS_ts1 <- xts_to_ts(Michigan_CS, start = as.Date("1980-01-01"), frequency = 12 )
ts_plot(Michigan_CS_ts1)

TSstudio documentation built on Aug. 9, 2023, 9:06 a.m.