powered by
Converts a series, stored in a data.frame or tibble, into a ts object.
df_to_ts(x, date_colname = "date", value_colname = "value", frequency = 12)
A ts object
ts
A data.frame, tibble or data.table.
data.frame
tibble
data.table
Name of the date column. Defaults to 'date'. Must be of class Date.
'date'
Date
Name of the value column. Defaults to 'value'. Must be numeric.
'value'
numeric
The frequency of the series. Can be a shortened string (e.g. "M" for monthly) or a number (e.g. 12).
ibc <- df_to_ts(ibcbr, value_colname = "index", frequency = "M") class(ibc) plot(ibc)
Run the code above in your browser using DataLab