From 8c7416a3fbb508916990b82d4998dfc9a974b0ae Mon Sep 17 00:00:00 2001 From: pierre Date: Sun, 29 Sep 2024 18:34:02 +0200 Subject: [PATCH] list of distances --- Rscripts/Rgraph.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Rscripts/Rgraph.R b/Rscripts/Rgraph.R index af0b351..0d8d3df 100644 --- a/Rscripts/Rgraph.R +++ b/Rscripts/Rgraph.R @@ -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 + } +} -- 2.7.4