View source: R/augment-ts-velocity.R
ts_velocity_augment | R Documentation |
Takes a numeric vector and will return the velocity of that vector.
ts_velocity_augment(.data, .value, .names = "auto")
.data |
The data being passed that will be augmented by the function. |
.value |
This is passed |
.names |
The default is "auto" |
Takes a numeric vector and will return the velocity of that vector. The velocity of a time series is computed by taking the first difference, so
x_t - x_t1
This function is intended to be used on its own in order to add columns to a tibble.
A augmented
Steven P. Sanderson II, MPH
Other Augment Function:
ts_acceleration_augment()
,
ts_growth_rate_augment()
suppressPackageStartupMessages(library(dplyr))
len_out = 10
by_unit = "month"
start_date = as.Date("2021-01-01")
data_tbl <- tibble(
date_col = seq.Date(from = start_date, length.out = len_out, by = by_unit),
a = rnorm(len_out),
b = runif(len_out)
)
ts_velocity_augment(data_tbl, b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.