In data frame objects (data.frame
, tibble
, data.table
), tsbox
automatically detects the time and the value column. This function changes
the column names to the defaults (time
, value
), so that auto-detection
can be avoided in future operations.
ts_default(x)
x | ts-boxable time series, an object of class |
---|
a ts-boxable time series, with the same class as the input.
df <- ts_df(ts_c(mdeaths, fdeaths)) # non-default colnames colnames(df) <- c("id", "date", "count") # switch back to default colnames head(ts_default(df))#>#> id time value #> 1 mdeaths 1974-01-01 2134 #> 2 mdeaths 1974-02-01 1863 #> 3 mdeaths 1974-03-01 1877 #> 4 mdeaths 1974-04-01 1877 #> 5 mdeaths 1974-05-01 1492 #> 6 mdeaths 1974-06-01 1249