Description Usage Arguments Examples
Calculates the rate of change of a value, provided a time variable.
time
and units
should be compatible with the lubridate
package
1 |
x |
value to calculate the rate of |
time |
date or time variable to be used in the calculations of rate |
unit |
units of time to be used in output |
historic |
accepts |
1 2 3 4 5 6 7 8 9 10 11 | x <- c(4, 2, 1, 4, 6, 7, 4, 2, 2, 9)
time <- lubridate::ymd(c(
"2000-08-23", "2000-04-19", "2000-10-12", "2000-07-22", "2000-12-13",
"2000-06-20", "2000-01-02", "2000-11-12", "2000-03-11", "2000-08-04"
))
get_rate(x, time)
## Not run:
df <- tibble::tibble(x, time) %>%
dplyr::mutate(x.rate = get_rate(x, time, historic = "average"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.