Skip to content

Commit

Permalink
Merge branch 'dist-maxdist-attr'
Browse files Browse the repository at this point in the history
  • Loading branch information
jarioksa committed Jun 4, 2024
2 parents 4a1e8ac + 77baf7a commit 85d1ab7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/avgdist.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions R/isomapdist.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion R/taxa2dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions R/treedist.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 85d1ab7

Please sign in to comment.