Duplicated
Description (description)
Duplicated () determines which elements of a vector or data frame is duplicates of elements with smaller subscripts, and R Eturns a logical vector indicating which elements (rows) is duplicates. The duplicated () function is used to determine a vector or a repeating element of a data frame, subscript a smaller element, and returns a logical vector indicating which elements (rows) are duplicates.
So by default, the element with the lowest subscript is preserved, and if you want to keep the largest element, you can use the following statement:
table_dup<-table[!duplicated (table, fromlast=true),]
Fromlast is to keep the last row in the repeating row
Delete the same table_dup=table[!duplicated (table) as the data in all columns,]
Selective deletion of duplicate
Table_dup=test[!duplicated (Table[,c (2,3)),]//for an example
Unique
For a vector, it doesn't work for the matrix or data frame.