pc | R Documentation |
Calculate percentage change
pc(x, n, order_by = NULL)
x |
A numeric vector |
n |
Positive integer of length 1, giving the number of positions to lead or lag by |
order_by |
Override the default ordering to use another vector or column |
df <- data.frame(time = c(1,2,3,4), x = c(100,101,100,98))
dplyr::mutate(df, d = pc(x, 1, time))
dplyr::mutate(df, d = pc(x, 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.