Description Usage Arguments Value Examples
leads_and_lags can be used to add in leads or lags of a variables
1 | leads_and_lags(df, variable, foo, x)
|
df |
data frame |
variable |
the variable to lead or lag |
foo |
the function to use (lead or lag) |
x |
the number of leads or lags to include |
a leaded or lagged vector to data frame
1 2 3 4 5 | edat <- edat %>%
group_by(region,fishery,gear) %>%
arrange(year) %>%
leads_and_lags(quo(`average price`),lag,0:5) %>%
leads_and_lags(quo(`average price`),lead,1:5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.