Given the indices of the duplicated entries remove the columns and rows until just one is left, it keeps the duplicated with the highest absolute mean value.
See also
duplicateIndices()
to obtain the list of indices with
duplicated entries.
Examples
a <- seq2mat(c("52", "52", "53", "55"), runif(choose(4, 2)))
b <- seq2mat(c("52", "52", "53", "55"), runif(choose(4, 2)))
mat <- list("kegg" = a, "react" = b)
mat
#> $kegg
#> 52 52 53 55
#> 52 1.0000000 0.6756428 0.7315595 0.1710480
#> 52 0.6756428 1.0000000 0.4839849 0.6758485
#> 53 0.7315595 0.4839849 1.0000000 0.2629899
#> 55 0.1710480 0.6758485 0.2629899 1.0000000
#>
#> $react
#> 52 52 53 55
#> 52 1.0000000 0.34148083 0.21024554 0.3767629
#> 52 0.3414808 1.00000000 0.01631959 0.5623074
#> 53 0.2102455 0.01631959 1.00000000 0.6799846
#> 55 0.3767629 0.56230740 0.67998461 1.0000000
#>
dupli <- duplicateIndices(rownames(a))
remat <- removeDup(mat, dupli)
remat
#> $kegg
#> 52 53 55
#> 52 1.0000000 0.4839849 0.6758485
#> 53 0.4839849 1.0000000 0.2629899
#> 55 0.6758485 0.2629899 1.0000000
#>
#> $react
#> 52 53 55
#> 52 1.0000000 0.2102455 0.3767629
#> 53 0.2102455 1.0000000 0.6799846
#> 55 0.3767629 0.6799846 1.0000000
#>