From b72bf654020b5e7de90a72ad3d019d8fc61af907 Mon Sep 17 00:00:00 2001 From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com> Date: Tue, 27 Aug 2024 20:38:30 +0100 Subject: [PATCH] match.fun(Combiner) --- R/tree_distance_msd.R | 4 ++-- R/tree_distance_utilities.R | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/R/tree_distance_msd.R b/R/tree_distance_msd.R index 181f3af1f..f65cb35e3 100644 --- a/R/tree_distance_msd.R +++ b/R/tree_distance_msd.R @@ -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, diff --git a/R/tree_distance_utilities.R b/R/tree_distance_utilities.R index 740fa33b0..6584cbaac 100644 --- a/R/tree_distance_utilities.R +++ b/R/tree_distance_utilities.R @@ -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