list of distances
authorpierre <ratinaud@univ-tlse2.fr>
Sun, 29 Sep 2024 16:34:02 +0000 (18:34 +0200)
committerpierre <ratinaud@univ-tlse2.fr>
Sun, 29 Sep 2024 16:34:02 +0000 (18:34 +0200)
Rscripts/Rgraph.R

index af0b351..0d8d3df 100644 (file)
@@ -1270,3 +1270,14 @@ graph.to.file2 <- function(graph, layout, nodesfile = NULL, edgesfile = NULL, co
        }
 }
 
+
+dist2list <- function(mat, outfile = NULL) {
+       m <- as.matrix(mat)
+       xy <- t(combn(colnames(m), 2))
+       m <- data.frame(xy, dist=m[xy])
+       if (!is.null(outfile)) {
+               write.csv2(m, file=outfile)
+       } else {
+               m
+       }
+}