make_tsibble: Convert data to a tsibble

View source: R/make_tsibble.R

make_tsibbleR Documentation

Convert data to a tsibble

Description

Convert a tibble containing time series data to a tsibble.

Usage

make_tsibble(main_frame, context)

Arguments

main_frame

A tibble containing the time series data.

context

A named list with the identifiers for series_id, value_id, and index_id.

Details

make_tsibble() is a small helper for time series cross-validation workflows. It uses the time index and series identifier supplied in context to create a regular tsibble.

The input data must contain the columns specified by context$index_id and context$series_id. The column specified by context$index_id is used as the time index, and the column specified by context$series_id is used as the key.

Value

A tsibble with the same columns as main_frame, using the index and key defined in context.

See Also

Other time series cross-validation: make_future(), make_split(), slice_test(), slice_train(), split_index()

Examples

library(dplyr)
library(tsibble)

context <- list(
  series_id = "series",
  value_id = "value",
  index_id = "index"
)

main_frame <- M4_monthly_data |>
  filter(series %in% c("M23100", "M14395"))

tsibble_frame <- make_tsibble(
  main_frame = main_frame,
  context = context
)

tsibble_frame

tscv documentation built on May 13, 2026, 9:07 a.m.