0

I have a data set as below which includes the IDs for segments, their ranges coordinates (start & end), the length of the segment and the traffic load on that part of the segment. A specific segment might have several records and ranges which might overlap with each other. A data sample of my input is as below:

enter image description here

I need to remove these overlaps from the ranges by making smaller segments based on each ID and providing the new segment ranges for an ID which has no overlap with each other. In the meanwhile I also need to calculate the average of the traffic load on each new segment range based on the average of the traffic load on the original segments which it belongs to. I have provided my desired output and calculations as table below.

enter image description here

F.gh
  • 23
  • 6
  • 3
    Nice images. But ... I don't want to spend time transcribing your pictures of tables into something usable. I suggest you edit your question to include *copyable* data, perhaps using `dput(head(x))`; it and other methods suggested at https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – r2evans Apr 20 '18 at 23:00
  • not clear how you calculate the Traffic Load. the data seems diff from what you describe. why dont you just average load across intervals of 0.5 in each row and then aggregate them? – chinsoon12 Apr 20 '18 at 23:02

0 Answers0