Skip to contents

Converts data from hub format to tsibble format for use with fable package.

Usage

convert_hub_to_tsibble(
  hub_data,
  date_col = "date",
  value_col = "value",
  location_col = "location",
  index = "date",
  key = "location"
)

Arguments

hub_data

Data frame in hub format with columns for date, location, value, etc.

date_col

Character. Name of the date column. Default is "date".

value_col

Character. Name of the value column. Default is "value".

location_col

Character. Name of the location column. Default is "location".

index

Character. Name to use for the time index. Default is "date".

key

Character vector. Key variables for tsibble. Default is "location".

Value

A tsibble object

Examples

if (FALSE) { # \dontrun{
hub_data <- data.frame(
  date = seq.Date(as.Date("2023-01-01"), by = "week", length.out = 10),
  location = "US",
  value = rnorm(10, 100, 10)
)
ts_data <- convert_hub_to_tsibble(hub_data)
} # }