I'm trying to filter such that once a unique number from a pair of number is found starting from the top of the matrix, any subsequent pair entry is removed from the matrix leaving only the the filtered data.
T_data = c(7,9,8,10,2,10,5,9,1,8,2,1,4,7,5,4,2,5)
T_new = matrix(T_data,ncol=2,byrow=TRUE)
desired output: 7 9, 8 10, 2 1, 5 4
# Desired output
> matrix(c(7, 9, 8, 10, 2, 1, 5, 4), ncol = 2, byrow = TRUE)
[,1] [,2]
[1,] 7 9
[2,] 8 10
[3,] 2 1
[4,] 5 4
I've tried writing my own loop but I presume there is a simple way to do this in R?