Skip to content

Instantly share code, notes, and snippets.

@lmcstro
Created March 8, 2018 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmcstro/e2af03798a53d8e023fbf8f7086c7a20 to your computer and use it in GitHub Desktop.
Save lmcstro/e2af03798a53d8e023fbf8f7086c7a20 to your computer and use it in GitHub Desktop.
Blog on Location Analysis: Script for multilocation report
# Section 1. Multiple Journey Days
# this section generates a report of the to,from and days that have more
# journeys than days travelled (i.e. there was on average more than 1 trip per day)
# select the days/to/from that have more journeys than journey days
out.m <- which(journey.count.x>pred.journey.x, arr.in=TRUE)
# select the journey count for the multi-trip dates
journey.count <- journey.count.x[journey.count.x>pred.journey.x]
# select the journey days for the multi-trip dates
journey.days <- pred.journey.x[journey.count.x>pred.journey.x]
# make a ratio of journey/journey days
ratio.v <- round(large.journey.count.v / large.journey.days.v,2)
# append the journeys, journey days, ratio as columns to
# the from, to, day information
out.m <- cbind(out.m,journey.count,journey.days,
ratio.v)
out.m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment