From f650b655c7dc01ceb8dca69e8b7e38ed58af46f7 Mon Sep 17 00:00:00 2001 From: Jari Oksanen Date: Tue, 4 Jun 2024 14:21:13 +0300 Subject: [PATCH 1/2] paste used dissimilarity method to "avgdist" --- R/avgdist.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/avgdist.R b/R/avgdist.R index ca5f2c538..884be80b8 100644 --- a/R/avgdist.R +++ b/R/avgdist.R @@ -57,6 +57,6 @@ } output <- as.dist(output, diag = diag, upper = upper) attr(output, "call") <- match.call() - attr(output, "method") <- "avgdist" + attr(output, "method") <- paste("avgdist", dmethod) output } From 77baf7aebb35a0142e8bd41e2c8aa6cf94ca7733 Mon Sep 17 00:00:00 2001 From: Jari Oksanen Date: Tue, 4 Jun 2024 14:21:49 +0300 Subject: [PATCH 2/2] set "maxdist" attribute when feasible --- R/isomapdist.R | 1 + R/taxa2dist.R | 3 ++- R/treedist.R | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/R/isomapdist.R b/R/isomapdist.R index 28167325c..c1246addb 100644 --- a/R/isomapdist.R +++ b/R/isomapdist.R @@ -48,6 +48,7 @@ attr(dist, "critval") <- epsilon } attr(dist, "method") <- paste(attr(dist, "method"), "isomap") + attr(dist, "maxdist") <- NA attr(dist, "net") <- net attr(dist, "take") <- take attr(dist, "call") <- match.call() diff --git a/R/taxa2dist.R b/R/taxa2dist.R index 258bd70bb..ca844a88a 100644 --- a/R/taxa2dist.R +++ b/R/taxa2dist.R @@ -15,7 +15,7 @@ if (varstep) { add <- -diff(c(nrow(x), rich, 1)) add <- add/c(S, rich) - add <- add/sum(add) * 100 + add <- add/sum(add) * 100 # 100 after Clarke, veganish would be 1 } else { add <- rep(100/(ncol(x) + check), ncol(x) + check) @@ -31,6 +31,7 @@ out <- as.dist(out) attr(out, "method") <- "taxa2dist" attr(out, "steps") <- add + attr(out, "maxdist") <- 100 # after Clarke, veganish would be 1 if (missing(labels)) { attr(out, "Labels") <- rownames(x) } else { diff --git a/R/treedist.R b/R/treedist.R index 684707548..3c1d96025 100644 --- a/R/treedist.R +++ b/R/treedist.R @@ -33,5 +33,10 @@ attr(out, "method") <- if (relative) "treedist" else "raw treeedist" attr(out, "call") <- match.call() attr(out, "Labels") <- row.names(x) + ## if (relative) theoretical maximum is 2, but that is only + ## achieved when two zero-height trees (only one species) are + ## combined into above zero-height tree (two species), and + ## therefore we set here NA (but this can be reconsidered). + attr(out, "maxdist") <- NA out }