I am new to the R language. My problems are
- I want to manage the origin-destination location with multiple ids. Here is an example of my raw data (csv file)
vehicle_id | location | time |
---|---|---|
0111111111 | 13_100.27 | 13.58 |
0111111111 | 13_140.87 | 17.38 |
0222222222 | 12_445.78 | 02.15 |
Ps. there are many vehicle_id data which some are same id and differs.
- I would like to sum vehicle_id into groups and create the start and finish location based on time like this;
vehicle_id | location of origin | start time | location of destination | finish time |
---|---|---|---|---|
0111111111 | 13_100.27 | 13.58 | 13_140.87 | 17.38 |
0222222222 | 13_140.87 | 17.38 | 13_102.99 | 23.57 |
0333333333 | 12_445.78 | 02.15 | 10.589.58 | 05.69 |
How can I code it to get the result like above? Thanks for your help in advance.