diff --git a/DESCRIPTION b/DESCRIPTION index 2551b6c..56aa88c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ICIKendallTau Title: Calculates information-content-informed Kendall-tau -Version: 1.2.1 +Version: 1.2.2 Authors@R: c( person( given = c("Robert", "M"), diff --git a/NEWS.md b/NEWS.md index db7dfc6..86705a5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# ICIKendallTau 1.2.2 + +- Fixed a bug where passing a two vector list is **supposed** to restrict the comparisons to just those provided, but instead did all possible pairwise comparisons between the two things and all others available. + # ICIKendallTau 1.2.0 - Refactored much of `ici_kendalltau`, making the code more consistent and easier to extend, as well as providing more informative error messages. Thanks to @njtierney for suggestions. diff --git a/R/kendalltau.R b/R/kendalltau.R index ac09494..a387667 100644 --- a/R/kendalltau.R +++ b/R/kendalltau.R @@ -212,9 +212,15 @@ setup_comparisons = function(samples, # of the sets against each of the lists. Again, this returns TRUE where # they match. Because we want the things where they # are both TRUE (assuming l1[1] goes with l2[1]), we use the AND at the end. - l1_include = (named_comparisons$s1 %in% include_only[[1]]) | (named_comparisons$s2 %in% include_only[[1]]) - l2_include = (named_comparisons$s1 %in% include_only[[2]]) | (named_comparisons$s2 %in% include_only[[2]]) - named_comparisons = named_comparisons[(l1_include & l2_include), ] + l1_l2 = paste0(include_only[[1]], "-", include_only[[2]]) + l2_l1 = paste0(include_only[[2]], "-", include_only[[1]]) + + all_include = c(l1_l2, l2_l1) + all_compare = paste0(named_comparisons$s1, "-", named_comparisons$s2) + + keep_compare = all_compare %in% all_include + named_comparisons = named_comparisons[keep_compare, ] + } else { cli::cli_abort(message = c( '{.arg {include_arg}} must be a vector, a data.frame with two columns, or list of two vectors.', @@ -238,7 +244,7 @@ setup_comparisons = function(samples, n_each = ceiling(n_todo / ncore) which_core = rep(seq(1, ncore), each = n_each) - which_core = which_core[1:nrow(named_comparisons)] + which_core = which_core[seq_len(nrow(named_comparisons))] named_comparisons$core = which_core if (which %in% "icikt") { diff --git a/docs/404.html b/docs/404.html index 6427b5a..763df9a 100644 --- a/docs/404.html +++ b/docs/404.html @@ -24,7 +24,7 @@ ICIKendallTau - 1.2.0 + 1.2.2