# NOT RUN {
data(SPrail)
# Calculate within- and between-route variation in price and add it to the data
SPrail <- SPrail %>%
dplyr::mutate(
within_route = within_i(price, .i = c(origin, destination)),
between_route = between_i(price, .i = c(origin, destination))
)
# }
Run the code above in your browser using DataLab