Skip to content

Commit

Permalink
updated comparisons code to properly
Browse files Browse the repository at this point in the history
handle just the comparisons we are defining we want to do
  • Loading branch information
rmflight committed Jul 24, 2024
1 parent 07dcab7 commit 7897bd1
Show file tree
Hide file tree
Showing 36 changed files with 68 additions and 47 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 10 additions & 4 deletions R/kendalltau.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand All @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/CODE_OF_CONDUCT.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions docs/articles/ici-kendalltau.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/testing-for-left-censorship.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pandoc: 3.1.12.3
pandoc: 3.1.11
pkgdown: 2.0.7
pkgdown_sha: ~
articles:
ici-kendalltau: ici-kendalltau.html
testing-for-left-censorship: testing-for-left-censorship.html
last_built: 2024-07-18T22:16Z
last_built: 2024-07-24T14:30Z

2 changes: 1 addition & 1 deletion docs/reference/add_uniform_noise.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/calculate_matrix_medians.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/cor_fast.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/cor_matrix_2_long_df.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/disable_logging.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/enable_logging.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/ici_kendalltau.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/ici_kendalltau_ref.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/ici_kt.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/kt_fast.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/log_memory.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/log_message.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/long_df_2_cor_matrix.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/missing_dataset.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7897bd1

Please sign in to comment.