Fix label issue in multi-vc CA
Change-Id: I9df9c648851cd65812aec509a4ed9abe5c1691ba
diff --git a/R/collocationAnalysis.R b/R/collocationAnalysis.R
index bbd017d..86cfb23 100644
--- a/R/collocationAnalysis.R
+++ b/R/collocationAnalysis.R
@@ -115,7 +115,7 @@
result <- if (length(node) > 1 || length(vc) > 1) {
grid <- if (expand) expand_grid(node = node, vc = vc) else tibble(node = node, vc = vc)
- purrr::pmap(grid, function(node, vc, ...) {
+ multi_result <- purrr::pmap(grid, function(node, vc, ...) {
collocationAnalysis(kco,
node = node,
vc = vc,
@@ -136,9 +136,15 @@
...
)
}) |>
- bind_rows() |>
- mutate(label = queryStringToLabel(vc)) |>
- add_multi_vc_comparisons(thresholdScore = thresholdScore, missingScoreFactor = multiVcMissingScoreFactor)
+ bind_rows()
+
+ if (!"vc" %in% names(multi_result) || nrow(multi_result) == 0) {
+ multi_result
+ } else {
+ multi_result |>
+ mutate(label = queryStringToLabel(.data$vc)) |>
+ add_multi_vc_comparisons(thresholdScore = thresholdScore, missingScoreFactor = multiVcMissingScoreFactor)
+ }
} else {
set.seed(seed)
candidates <- collocatesQuery(