I have a dataframe like z:
z <- matrix(c(1,0,0,1,1,0,0, 1,0,0,0,1,0,0, 0,0,0,0,0,0,0, 0,0,1,0,0,0,0), nrow=7, dimnames=list(LETTERS[1:7],NULL)) [,1] [,2] [,3] [,4] A 1 1 0 0 B 0 0 0 0 C 0 0 0 1 D 1 0 0 0 E 1 1 0 0 F 0 0 0 0 G 0 0 0 0
Now I want to remove duplicate rows where the values โโof columns 1, 2 and 3 are the same.
- Delete line E because it is identical to A.
- Delete lines C, F and G because they are identical to B.
The result should be like this:
[,1] [,2] [,3] [,4] A 1 1 0 0 B 0 0 0 0 D 1 0 0 0
Can anyone help me with this? Many thanks!