Skip to Content

Extract integers from ranges

In R, what's an efficient way to extract the integers from ranges?

Let's say I have a matrix of ranges (column1=start, column2=end)

1   5
3   6
10  13

I would like to store the encompassing unique integers of all the ranges in the matrix into an object:

1
2
3
4
5
6
10
11
12
13

This would be applied to a matrix containing ~4 million ranges, so hopefully someone can offer a solution that is somewhat efficient.