## 10.12 Lag Variable Calculations

20220523 A common task in wrangling a dataset is to calculate the difference between a current value and that from the previous row. The function dplyr::lag() can be used to do this, in combination with dplyr::first() to get the first value.

"gas_consumption.csv" %>%
...