View source: R/util_functions.R
xts_to_ts | R Documentation |
Converting 'xts' object to 'ts' object
xts_to_ts(xts.obj, frequency = NULL, start = NULL)
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 |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.