Learn R Programming

tsibble (version 0.7.0)

update_tsibble: Update key and index for a tsibble

Description

Update key and index for a tsibble

Usage

update_tsibble(x, key = NULL, index = NULL, regular = NULL,
  validate = TRUE)

Arguments

x

A tsibble.

key

Variable(s) that define unique time indices, used in conjunction with the helper id(). If a univariate time series (without an explicit key), simply call id().

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.

Details

Default NULL inherits attributes from x.

Examples

Run this code
# NOT RUN {
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 DataLab