I have a hierarchical data as below. But it has circular structure. I want to delete the rows that cause the circular structure.
orderNo | from | to | group1 |
---|---|---|---|
1 | A | B | 0 |
2 | B | C | 0 |
3 | C | A | 0 |
4 | A | D | 0 |
1 | X | Y | 1 |
2 | Y | W | 1 |
3 | W | X | 1 |
Data is something like that. I want to remove 3th and 7th rows from dataset.
There is a problem similar to the one in the answer in the link.
How can i do this in R? Can anyone help me?