build_tsibble: Low-level constructor for a tsibble object
Description
build_tsibble() creates a tbl_ts object with more controls. It is useful
for creating a tbl_ts internally inside a function, and it allows developers to
determine if the time needs ordering and the interval needs calculating.
A data.frame, tbl_df, tbl_ts, or other tabular objects.
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.
index2
A candidate of index to update the index to a new one when
index_by. By default, it's identical to index.
ordered
The default of NULL arranges the key variable(s) first and
then index from past to future. TRUE suggests to skip the ordering as x in
the correct order. FALSE also skips the ordering but gives a warning instead.
regular
Regular time interval (TRUE) or irregular (FALSE). The
interval is determined by the greatest common divisor of index column, if TRUE.
interval
NULL computes the interval. Use the specified interval via
new_interval() as is, if an class of interval is supplied.
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.
# NOT RUN {# Prepare `pedestrian` to use a new index `Date` ----pedestrian %>%
build_tsibble(
key = key(.), index = !! index(.), index2 = Date, interval = interval(.)
)
# }