Maturing lifecycle

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

library(dplyr) pedestrian %>% group_by_key() %>% mutate(Hour_Since = Date_Time - min(Date_Time)) %>% update_tsibble(index = Hour_Since)
#> # A tsibble: 66,037 x 6 [1h] #> # Key: Sensor [4] #> # Groups: Sensor [4] #> Sensor Date_Time Date Time Count Hour_Since #> <chr> <dttm> <date> <int> <int> <drtn> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 0 secs #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 3600 secs #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 7200 secs #> 4 Birrarung Marr 2015-01-01 03:00:00 2015-01-01 3 264 10800 secs #> 5 Birrarung Marr 2015-01-01 04:00:00 2015-01-01 4 139 14400 secs #> 6 Birrarung Marr 2015-01-01 05:00:00 2015-01-01 5 77 18000 secs #> 7 Birrarung Marr 2015-01-01 06:00:00 2015-01-01 6 44 21600 secs #> 8 Birrarung Marr 2015-01-01 07:00:00 2015-01-01 7 56 25200 secs #> 9 Birrarung Marr 2015-01-01 08:00:00 2015-01-01 8 113 28800 secs #> 10 Birrarung Marr 2015-01-01 09:00:00 2015-01-01 9 166 32400 secs #> # … with 66,027 more rows