I want to create a data structure in the form of
Start, End, Elements
3 , 6 , {4,5}
4 , 10 , {7,8,9}
....
In words, I am moving a ball along a line. The "start" represents the left most position of the ball and the "End" represents the right most. The "Elements" means I somehow find those positions special. What is the best data structure to use when the number of elements can grow very large? The only thing I can think of is a data frame where the 3rd column is an appropriately formatted string. I would then have to parse the string if I wanted to look at each number in the set. Is there a better data format that R has or is that about it?
Thanks!