# NOT RUN {
data(SPrail)
# In preparation for fitting a choice model for how people choose ticket type,
# I'd like to know the price of a "Promo" ticket for a given route
# So that I can compare each other type of ticket price to that type
SPrail <- SPrail %>%
mutate_subset(
promo_price = mean(price, na.rm = TRUE),
.filter = fare == "Promo",
.i = c(origin, destination)
)
# }
Run the code above in your browser using DataLab