[R] How to process raw trip records to get number of persons per trip by vehicle
Walter Anderson
wandrson01 at gmail.com
Fri May 27 15:28:34 CEST 2011
I have a large data set containing travel records for a para-transit
system. There is one record for each person transported, that contains
the following information:
Vehicle.Id Customer.Id Trip.Date TimeOn TimeOff Fare
W36 1 2009.07.01 09:15
09:53 3.75
W36 2 2009.07.01 09:23
09:57 3.75
W36 3 2009.07.01 11:40
13:06 5.45
W35 1 2009.07.08 09:19 09:58
3.75
W36 2 2009.07.09 09:43
10:07 3.75
...
And I need to process it to end up one record per "trip" the vehicle
makes, determining the number of passengers transported that trip.
Something like the following:
Trip.Date Vehicle.Id Trip.Start Trip.End
Number.of.passengers Total.Revenue
2009.07.01 W36 09:15 09:57 2
7.50
2009.07.01 W36 11:40 13:06 1
5.45
2009.07.08 W35 09:19 09:58 1
3.75
2009.07.09 W36 09:43 10:07 1
3.75
I can think of a procedure to process the data that is a very
traditional algorithm type, but it doesn't make use of any of the R
features. Does anyone have any suggestions for how they would implement
this analysis in R?
Walter Anderson
More information about the R-help
mailing list