Skip to contents

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.

Usage

removeDup(cor_mat, dupli)

Arguments

cor_mat

List of matrices

dupli

List of indices with duplicated entries

Value

A matrix with only one of the columns and rows duplicated

See also

duplicateIndices() to obtain the list of indices with duplicated entries.

Author

Lluís Revilla

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.3247569 0.1327160 0.3309296
#> 52 0.3247569 1.0000000 0.6372974 0.6490796
#> 53 0.1327160 0.6372974 1.0000000 0.3028884
#> 55 0.3309296 0.6490796 0.3028884 1.0000000
#> 
#> $react
#>            52         52        53        55
#> 52 1.00000000 0.07123327 0.6623905 0.5533602
#> 52 0.07123327 1.00000000 0.7596036 0.5392721
#> 53 0.66239047 0.75960356 1.0000000 0.8495923
#> 55 0.55336017 0.53927210 0.8495923 1.0000000
#> 
dupli <- duplicateIndices(rownames(a))
remat <- removeDup(mat, dupli)
remat
#> $kegg
#>           52        53        55
#> 52 1.0000000 0.6372974 0.6490796
#> 53 0.6372974 1.0000000 0.3028884
#> 55 0.6490796 0.3028884 1.0000000
#> 
#> $react
#>           52        53        55
#> 52 1.0000000 0.7596036 0.5392721
#> 53 0.7596036 1.0000000 0.8495923
#> 55 0.5392721 0.8495923 1.0000000
#>