Say I have some ranges represented by start coordinates start<-c(1,2,3) and end coordiantes end<-c(4,5,4) ;ranges<-data.frame(start,end) How can I split this up into one length intervals?
i.e. I want
this
starts ends
1 1 4
2 2 5
3 3 4
to be transformed into this:
starts ends
1 1 2 |
2 3 4 <-end of original first interval
3 2 3 |
4 4 5 <-end of original second interval
5 3 4 <-end of original third interval
right now I have a for loop iterating through the list and creating a sequence sequence that goes from start to end but this loop takes a very long time to execute for long lists of ranges.
You could try creating text for the vectors,
parse-ing andeval-uating and then using amatrixto create thedata.frame: