key: or other tidyselect-compatible functions, 'key_vars()' acts...

View source: R/tsibble-meta.R

keyR Documentation

or other tidyselect-compatible functions, key_vars() acts as a selection helper that automatically selects all key columns from the tsibble.

Description

or other tidyselect-compatible functions, key_vars() acts as a selection helper that automatically selects all key columns from the tsibble.

Usage

key(x)

key_vars(x)

Arguments

x

A tsibble.

Examples

key(pedestrian)
key_vars(pedestrian)

key(tourism)
key_vars(tourism)

# Use as a tidyselect helper
library(dplyr)
tourism %>% select(index_var(), key_vars())

# Combine with other tidyselect functions
tourism %>% relocate(key_vars(), .after = last_col())

tsibble documentation built on Feb. 9, 2026, 5:06 p.m.