tsibble (version 0.7.0)

new_data: New tsibble data and append new observations to a tsibble

Description

append_row(): add new rows to the end of a tsibble by filling a key-index pair and NA for measured variables.

append_case() is an alias of append_row().

Usage

new_data(.data, n = 1L, ...)

# S3 method for tbl_ts new_data(.data, n = 1L, keep_all = FALSE, ...)

append_row(.data, n = 1L, ...)

Arguments

.data

A tbl_ts.

n

An integer indicates the number of key-index pair to append.

...

Passed to individual S3 method.

keep_all

If TRUE keep all the measured variables as well as index and key, otherwise only index and key.

Examples

Run this code
# NOT RUN {
new_data(pedestrian)
new_data(pedestrian, keep_all = TRUE)
new_data(pedestrian, n = 3)
tsbl <- tsibble(
  date = rep(as.Date("2017-01-01") + 0:2, each = 2), 
  group = rep(letters[1:2], 3),
  value = rnorm(6),
  key = id(group)
)
append_row(tsbl)
append_row(tsbl, n = 2)
# }

Run the code above in your browser using DataCamp Workspace