I have the data as follows:
V1 V2
1 10001 1003
2 10002 1005
3 10002 1007
4 10003 1001
5 10003 1005
...
These are edge list data.
The index of V1 is really sparse, only a few of numbers in [1..10001] are occupied.
For example, it is something like max(V1) = 20000 but range(V1) = [10000, 20000].
I want to compress the index.
Here's what I've done:
sorted <- sort(data, index.return = T)
However for duplicated node index, different sorted index is returned. Also, I need the inverse index of the returned index (or, sorted$ix).
I'm new to R and how shall I do it?