tsibble (version 0.8.2)

update_tsibble: Update key and index for a tsibble

Description

Update key and index for a tsibble

Usage

update_tsibble(x, key, index, regular = is_regular(x), validate = TRUE,
  .drop = key_drop_default(x))

Arguments

x

A tsibble.

key

Unquoted variable(s) that uniquely determine time indices. NULL for empty key, and works with tidy selector (e.g. dplyr::starts_with()).

index

A bare (or unquoted) variable to specify the time index variable.

regular

Regular time interval (TRUE) or irregular (FALSE). The interval is determined by the greatest common divisor of index column, if TRUE.

validate

TRUE suggests to verify that each key or each combination of key variables leads to unique time indices (i.e. a valid tsibble). If you are sure that it's a valid input, specify FALSE to skip the checks.

.drop

If TRUE, empty key groups are dropped.

Details

Unspecified arguments will inherit the attributes from x.

Examples

Run this code
# NOT RUN {
library(dplyr)
pedestrian %>% 
  group_by_key() %>% 
  mutate(Hour_Since = Date_Time - min(Date_Time)) %>% 
  update_tsibble(index = Hour_Since)
# }

Run the code above in your browser using DataCamp Workspace