Skip to content

Commit

Permalink
match.fun(Combiner)
Browse files Browse the repository at this point in the history
  • Loading branch information
ms609 committed Aug 27, 2024
1 parent 9630318 commit b72bf65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/tree_distance_msd.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
#' @export
MatchingSplitDistance <- function(tree1, tree2 = NULL, normalize = FALSE,
reportMatching = FALSE) {
unnormalized <- CalculateTreeDistance(MatchingSplitDistanceSplits, tree1, tree2,
reportMatching)
unnormalized <- CalculateTreeDistance(MatchingSplitDistanceSplits, tree1,
tree2, reportMatching)

# Return:
NormalizeInfo(unnormalized, tree1, tree2, how = normalize,
Expand Down
5 changes: 4 additions & 1 deletion R/tree_distance_utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,10 @@ NormalizeInfo <- function(unnormalized, tree1, tree2, InfoInTree,
CombineInfo <- function(tree1Info, tree2Info, Combiner = Combine,
pairwise = FALSE) {
if (length(tree1Info) == 1 || length(tree2Info) == 1 || pairwise) {
unlist(.mapply(Combiner, dots = list(tree1Info, tree2Info), NULL))
# TODO When requriring R4.0, remove match.fun - which is now part of
# .mapply
unlist(.mapply(match.fun(Combiner),
dots = list(tree1Info, tree2Info), NULL))
} else {
ret <- outer(tree1Info, tree2Info, Combiner)
if (inherits(unnormalized, "dist")) ret[lower.tri(ret)] else ret
Expand Down

0 comments on commit b72bf65

Please sign in to comment.