Learn R Programming

tsibble (version 1.2.0)

key: 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

Run this code
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())

Run the code above in your browser using DataLab