From 9abe012ad93b75cc4ad723d969758141496ed719 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 10:52:50 +0000 Subject: [PATCH 1/5] Deprecate threads in dig_* functions Co-authored-by: beerda <26056018+beerda@users.noreply.github.com> --- R/dig_associations.R | 15 +++++++++++++-- R/dig_baseline_contrasts.R | 12 ++++++++++-- R/dig_complement_contrasts.R | 12 ++++++++++-- R/dig_correlations.R | 12 ++++++++++-- R/dig_grid.R | 15 ++++++++++++--- R/dig_paired_baseline_contrasts.R | 12 ++++++++++-- R/dig_tautologies.R | 14 +++++++++++--- 7 files changed, 76 insertions(+), 16 deletions(-) diff --git a/R/dig_associations.R b/R/dig_associations.R index a736712f..a7e61c3c 100644 --- a/R/dig_associations.R +++ b/R/dig_associations.R @@ -120,7 +120,8 @@ #' to set `max_results` to a reasonable positive value. Setting `max_results` #' to `Inf` will generate all possible conditions. #' @param verbose a logical value indicating whether to print progress messages. -#' @param threads the number of threads to use for parallel computation. +#' @param threads (Deprecated.) the number of threads to use for parallel +#' computation. #' @param error_context a named list providing context for error messages. #' This is mainly useful when `dig_associations()` is called from another #' function and you want error messages to refer to the argument names @@ -172,7 +173,7 @@ dig_associations <- function(x, t_norm = "goguen", max_results = Inf, verbose = FALSE, - threads = 1, + threads = deprecated(), error_context = list(arg_x = "x", arg_antecedent = "antecedent", arg_consequent = "consequent", @@ -217,6 +218,16 @@ dig_associations <- function(x, } else { contingency_table <- TRUE } + + if (lifecycle::is_present(threads) && + (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { + deprecate_warn(when = "2.2.0", + what = "nuggets::dig_associations(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } else if (!lifecycle::is_present(threads)) { + threads <- 1L + } + .must_be_flag(contingency_table, arg = error_context$arg_contingency_table, call = error_context$call) diff --git a/R/dig_baseline_contrasts.R b/R/dig_baseline_contrasts.R index affe90f1..b56361f6 100644 --- a/R/dig_baseline_contrasts.R +++ b/R/dig_baseline_contrasts.R @@ -116,7 +116,8 @@ #' to set `max_results` to a reasonable positive value. Setting `max_results` #' to `Inf` will generate all possible conditions. #' @param verbose a logical scalar indicating whether to print progress messages. -#' @param threads the number of threads to use for parallel computation. +#' @param threads (Deprecated.) the number of threads to use for parallel +#' computation. #' @return An S3 object which is an instance of `baseline_contrasts` and `nugget` #' classes and which is a tibble with found patterns in rows. The following #' columns are always present: @@ -179,7 +180,7 @@ dig_baseline_contrasts <- function(x, wilcox_digits_rank = Inf, max_results = Inf, verbose = FALSE, - threads = 1) { + threads = deprecated()) { .must_be_enum(method, c("t", "wilcox")) .must_be_enum(alternative, c("two.sided", "less", "greater")) .must_be_double_scalar(h0) @@ -192,6 +193,12 @@ dig_baseline_contrasts <- function(x, .must_be_double_scalar(wilcox_tol_root) .must_be_double_scalar(wilcox_digits_rank) + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.2.0", + what = "nuggets::dig_baseline_contrasts(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + condition <- enquo(condition) vars <- enquo(vars) @@ -255,6 +262,7 @@ dig_baseline_contrasts <- function(x, arg_max_results = "max_results", arg_verbose = "verbose", arg_threads = "threads", + deprecate_threads = FALSE, call = current_env())) digattr <- attributes(res) diff --git a/R/dig_complement_contrasts.R b/R/dig_complement_contrasts.R index 861afbb3..dc8d44a7 100644 --- a/R/dig_complement_contrasts.R +++ b/R/dig_complement_contrasts.R @@ -127,7 +127,8 @@ #' to set `max_results` to a reasonable positive value. Setting `max_results` #' to `Inf` will generate all possible conditions. #' @param verbose a logical scalar indicating whether to print progress messages. -#' @param threads the number of threads to use for parallel computation. +#' @param threads (Deprecated.) the number of threads to use for parallel +#' computation. #' @return An S3 object which is an instance of `complement_contrasts` and `nugget` #' classes and which is a tibble with found patterns in rows. The following #' columns are always present: @@ -194,7 +195,7 @@ dig_complement_contrasts <- function(x, wilcox_digits_rank = Inf, max_results = Inf, verbose = FALSE, - threads = 1L) { + threads = deprecated()) { .must_be_enum(method, c("t", "wilcox", "var")) .must_be_enum(alternative, c("two.sided", "less", "greater")) .must_be_double_scalar(h0) @@ -208,6 +209,12 @@ dig_complement_contrasts <- function(x, .must_be_double_scalar(wilcox_tol_root) .must_be_double_scalar(wilcox_digits_rank) + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.2.0", + what = "nuggets::dig_complement_contrasts(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + condition <- enquo(condition) vars <- enquo(vars) @@ -282,6 +289,7 @@ dig_complement_contrasts <- function(x, arg_max_results = "max_results", arg_verbose = "verbose", arg_threads = "threads", + deprecate_threads = FALSE, call = current_env())) digattr <- attributes(res) diff --git a/R/dig_correlations.R b/R/dig_correlations.R index 399c3837..78d78d90 100644 --- a/R/dig_correlations.R +++ b/R/dig_correlations.R @@ -93,7 +93,8 @@ #' to set `max_results` to a reasonable positive value. Setting `max_results` #' to `Inf` will generate all possible conditions. #' @param verbose a logical scalar indicating whether to print progress messages. -#' @param threads the number of threads to use for parallel computation. +#' @param threads (Deprecated.) the number of threads to use for parallel +#' computation. #' @return An S3 object which is an instance of `correlations` and `nugget` #' classes and which is tibble with found patterns. #' The `nugget` object also contains metadata about the search @@ -134,11 +135,17 @@ dig_correlations <- function(x, max_support = 1.0, max_results = Inf, verbose = FALSE, - threads = 1) { + threads = deprecated()) { .must_be_enum(method, c("pearson", "kendall", "spearman")) .must_be_enum(alternative, c("two.sided", "less", "greater")) .must_be_flag(exact, null = TRUE) + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.2.0", + what = "nuggets::dig_correlations(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + condition <- enquo(condition) xvars <- enquo(xvars) yvars <- enquo(yvars) @@ -185,6 +192,7 @@ dig_correlations <- function(x, arg_max_results = "max_results", arg_verbose = "verbose", arg_threads = "threads", + deprecate_threads = FALSE, call = current_env())) digattr <- attributes(res) diff --git a/R/dig_grid.R b/R/dig_grid.R index a8ba319f..85dea9d2 100644 --- a/R/dig_grid.R +++ b/R/dig_grid.R @@ -123,7 +123,8 @@ #' to set `max_results` to a reasonable positive value. Setting `max_results` #' to `Inf` will generate all possible conditions. #' @param verbose a logical scalar indicating whether to print progress messages. -#' @param threads the number of threads to use for parallel computation. +#' @param threads (Deprecated.) the number of threads to use for parallel +#' computation. #' @param error_context a list of details to be used in error messages. #' This argument is useful when `dig_grid()` is called from another #' function to provide error messages, which refer to arguments of the @@ -203,7 +204,7 @@ dig_grid <- function(x, max_support = 1.0, max_results = Inf, verbose = FALSE, - threads = 1L, + threads = deprecated(), error_context = list(arg_x = "x", arg_f = "f", arg_condition = "condition", @@ -243,6 +244,15 @@ dig_grid <- function(x, call = error_context$call) } + if (lifecycle::is_present(threads) && + (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { + deprecate_warn(when = "2.2.0", + what = "nuggets::dig_grid(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } else if (!lifecycle::is_present(threads)) { + threads <- 1L + } + condition <- enquo(condition) cols <- .convert_data_to_list(x, error_context = error_context) @@ -385,4 +395,3 @@ dig_grid <- function(x, verbose = digattr$call_args$verbose, threads = digattr$call_args$threads)) } - diff --git a/R/dig_paired_baseline_contrasts.R b/R/dig_paired_baseline_contrasts.R index 5075d2c4..5c84b73a 100644 --- a/R/dig_paired_baseline_contrasts.R +++ b/R/dig_paired_baseline_contrasts.R @@ -128,7 +128,8 @@ #' to set `max_results` to a reasonable positive value. Setting `max_results` #' to `Inf` will generate all possible conditions. #' @param verbose a logical scalar indicating whether to print progress messages. -#' @param threads the number of threads to use for parallel computation. +#' @param threads (Deprecated.) the number of threads to use for parallel +#' computation. #' @return An S3 object which is an instance of `paired_baseline_contrasts` #' and `nugget` classes and which is a tibble with found patterns in rows. #' The following columns are always present: @@ -203,7 +204,7 @@ dig_paired_baseline_contrasts <- function(x, wilcox_digits_rank = Inf, max_results = Inf, verbose = FALSE, - threads = 1) { + threads = deprecated()) { .must_be_enum(method, c("t", "wilcox")) .must_be_enum(alternative, c("two.sided", "less", "greater")) .must_be_double_scalar(h0) @@ -217,6 +218,12 @@ dig_paired_baseline_contrasts <- function(x, .must_be_double_scalar(wilcox_tol_root) .must_be_double_scalar(wilcox_digits_rank) + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.2.0", + what = "nuggets::dig_paired_baseline_contrasts(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + condition <- enquo(condition) xvars <- enquo(xvars) yvars <- enquo(yvars) @@ -282,6 +289,7 @@ dig_paired_baseline_contrasts <- function(x, arg_max_results = "max_results", arg_verbose = "verbose", arg_threads = "threads", + deprecate_threads = FALSE, call = current_env())) digattr <- attributes(res) diff --git a/R/dig_tautologies.R b/R/dig_tautologies.R index 693e870d..8d0ae0b2 100644 --- a/R/dig_tautologies.R +++ b/R/dig_tautologies.R @@ -75,7 +75,8 @@ #' to set `max_results` to a reasonable positive value. Setting `max_results` #' to `Inf` will generate all possible conditions. #' @param verbose a logical value indicating whether to print progress messages. -#' @param threads the number of threads to use for parallel computation. +#' @param threads (Deprecated.) the number of threads to use for parallel +#' computation. #' @returns An S3 object which is an instance of `associations` and `nugget` #' classes and which is a tibble with found tautologies in the format equal #' to the output of [dig_associations()]. @@ -100,13 +101,19 @@ dig_tautologies <- function(x, t_norm = "goguen", max_results = Inf, verbose = FALSE, - threads = 1) { + threads = deprecated()) { .must_be_integerish_scalar(max_length) .must_be_greater_eq(max_length, 0) .must_be_integerish_scalar(max_results) .must_be_greater_eq(max_results, 1) + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.2.0", + what = "nuggets::dig_tautologies(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + antecedent <- enquo(antecedent) consequent <- enquo(consequent) tautologies <- list() @@ -163,6 +170,7 @@ dig_tautologies <- function(x, arg_max_results = "internal `maxres`", arg_verbose = "verbose", arg_threads = "threads", + deprecate_threads = FALSE, call = current_env())) if (is.null(digattr)) { @@ -195,5 +203,5 @@ dig_tautologies <- function(x, t_norm = t_norm, max_results = max_results, verbose = verbose, - threads = threads)) + threads = digattr$call_args$threads)) } From 548a2b69d385d71ca376423e1326a194c06c2366 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 10:57:55 +0000 Subject: [PATCH 2/5] Bump deprecation version to 2.3.0 Co-authored-by: beerda <26056018+beerda@users.noreply.github.com> --- R/dig_associations.R | 4 ++-- R/dig_baseline_contrasts.R | 2 +- R/dig_complement_contrasts.R | 2 +- R/dig_correlations.R | 2 +- R/dig_grid.R | 2 +- R/dig_paired_baseline_contrasts.R | 2 +- R/dig_tautologies.R | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/dig_associations.R b/R/dig_associations.R index a7e61c3c..6b60a9d5 100644 --- a/R/dig_associations.R +++ b/R/dig_associations.R @@ -212,7 +212,7 @@ dig_associations <- function(x, call = error_context$call) if (lifecycle::is_present(contingency_table)) { - deprecate_warn(when = "2.2.0", + deprecate_warn(when = "2.3.0", what = "nuggets::dig_associations(contingency_table)", details = "The `contingency_table` argument is deprecated and will be removed in future versions. dig_associations() works as 'contingency_table = TRUE' would be specified by default.") } else { @@ -221,7 +221,7 @@ dig_associations <- function(x, if (lifecycle::is_present(threads) && (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { - deprecate_warn(when = "2.2.0", + deprecate_warn(when = "2.3.0", what = "nuggets::dig_associations(threads)", details = "The `threads` argument is deprecated and will be removed in future versions.") } else if (!lifecycle::is_present(threads)) { diff --git a/R/dig_baseline_contrasts.R b/R/dig_baseline_contrasts.R index b56361f6..a76062e5 100644 --- a/R/dig_baseline_contrasts.R +++ b/R/dig_baseline_contrasts.R @@ -194,7 +194,7 @@ dig_baseline_contrasts <- function(x, .must_be_double_scalar(wilcox_digits_rank) if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.2.0", + deprecate_warn(when = "2.3.0", what = "nuggets::dig_baseline_contrasts(threads)", details = "The `threads` argument is deprecated and will be removed in future versions.") } diff --git a/R/dig_complement_contrasts.R b/R/dig_complement_contrasts.R index dc8d44a7..3199abca 100644 --- a/R/dig_complement_contrasts.R +++ b/R/dig_complement_contrasts.R @@ -210,7 +210,7 @@ dig_complement_contrasts <- function(x, .must_be_double_scalar(wilcox_digits_rank) if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.2.0", + deprecate_warn(when = "2.3.0", what = "nuggets::dig_complement_contrasts(threads)", details = "The `threads` argument is deprecated and will be removed in future versions.") } diff --git a/R/dig_correlations.R b/R/dig_correlations.R index 78d78d90..be4127eb 100644 --- a/R/dig_correlations.R +++ b/R/dig_correlations.R @@ -141,7 +141,7 @@ dig_correlations <- function(x, .must_be_flag(exact, null = TRUE) if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.2.0", + deprecate_warn(when = "2.3.0", what = "nuggets::dig_correlations(threads)", details = "The `threads` argument is deprecated and will be removed in future versions.") } diff --git a/R/dig_grid.R b/R/dig_grid.R index 85dea9d2..ccda0829 100644 --- a/R/dig_grid.R +++ b/R/dig_grid.R @@ -246,7 +246,7 @@ dig_grid <- function(x, if (lifecycle::is_present(threads) && (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { - deprecate_warn(when = "2.2.0", + deprecate_warn(when = "2.3.0", what = "nuggets::dig_grid(threads)", details = "The `threads` argument is deprecated and will be removed in future versions.") } else if (!lifecycle::is_present(threads)) { diff --git a/R/dig_paired_baseline_contrasts.R b/R/dig_paired_baseline_contrasts.R index 5c84b73a..96dafd08 100644 --- a/R/dig_paired_baseline_contrasts.R +++ b/R/dig_paired_baseline_contrasts.R @@ -219,7 +219,7 @@ dig_paired_baseline_contrasts <- function(x, .must_be_double_scalar(wilcox_digits_rank) if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.2.0", + deprecate_warn(when = "2.3.0", what = "nuggets::dig_paired_baseline_contrasts(threads)", details = "The `threads` argument is deprecated and will be removed in future versions.") } diff --git a/R/dig_tautologies.R b/R/dig_tautologies.R index 8d0ae0b2..df44124b 100644 --- a/R/dig_tautologies.R +++ b/R/dig_tautologies.R @@ -109,7 +109,7 @@ dig_tautologies <- function(x, .must_be_greater_eq(max_results, 1) if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.2.0", + deprecate_warn(when = "2.3.0", what = "nuggets::dig_tautologies(threads)", details = "The `threads` argument is deprecated and will be removed in future versions.") } From ced07ae1f8b102bfba6456f12351f50eb03f92bf Mon Sep 17 00:00:00 2001 From: Michal Burda Date: Mon, 7 Sep 2026 13:04:23 +0200 Subject: [PATCH 3/5] Removed threads from tests --- tests/testthat/test-dig_associations.R | 9 ++------- tests/testthat/test-dig_baseline_contrasts.R | 4 +--- tests/testthat/test-dig_complement_contrasts.R | 4 +--- tests/testthat/test-dig_correlations.R | 4 +--- tests/testthat/test-dig_grid.R | 6 +----- tests/testthat/test-dig_paired_baseline_contrasts.R | 5 ++--- tests/testthat/test-dig_tautologies.R | 5 +---- 7 files changed, 9 insertions(+), 28 deletions(-) diff --git a/tests/testthat/test-dig_associations.R b/tests/testthat/test-dig_associations.R index 2c37fb75..97da66e9 100644 --- a/tests/testthat/test-dig_associations.R +++ b/tests/testthat/test-dig_associations.R @@ -389,8 +389,7 @@ test_that("dig_associations return object details", { min_support = 0.3, min_confidence = 0.5, t_norm = "lukas", - max_results = 10, - threads = 1) + max_results = 10) expect_true(is_nugget(res, "associations")) expect_true(is_tibble(res)) @@ -413,7 +412,6 @@ test_that("dig_associations return object details", { expect_equal(attr(res, "call_args")$contingency_table, TRUE) expect_equal(attr(res, "call_args")$t_norm, "lukas") expect_equal(attr(res, "call_args")$max_results, 10) - expect_equal(attr(res, "call_args")$threads, 1) expect_true(is_tibble(res)) }) @@ -452,8 +450,6 @@ test_that("dig_associations errors", { "`max_results` must be an integerish scalar.") expect_error(dig_associations(d, verbose = "x"), "`verbose` must be a flag.") - expect_error(dig_associations(d, threads = "x"), - "`threads` must be an integerish scalar.") }) test_that("dig_associations return nothing", { @@ -470,8 +466,7 @@ test_that("dig_associations return nothing", { min_confidence = 0.2, t_norm = "lukas", max_results = 5, - verbose = FALSE, - threads = 1) + verbose = FALSE) expect_true(is_nugget(res, "associations")) expect_true(is_tibble(res)) diff --git a/tests/testthat/test-dig_baseline_contrasts.R b/tests/testthat/test-dig_baseline_contrasts.R index 8664331a..a5fd9533 100644 --- a/tests/testthat/test-dig_baseline_contrasts.R +++ b/tests/testthat/test-dig_baseline_contrasts.R @@ -97,8 +97,7 @@ test_that("dig_baseline_contrasts call args", { wilcox_tol_root = 1e-3, wilcox_digits_rank = 5, max_results = 100, - verbose = TRUE, - threads = 1)) + verbose = TRUE)) expect_true(is_nugget(res, flavour = "baseline_contrasts")) expect_true(is_tibble(res)) @@ -138,7 +137,6 @@ test_that("dig_baseline_contrasts call args", { expect_equal(attr(res, "call_args")$wilcox_digits_rank, 5) expect_equal(attr(res, "call_args")$max_results, 100) expect_equal(attr(res, "call_args")$verbose, TRUE) - expect_equal(attr(res, "call_args")$threads, 1L) }) test_that("dig_baseline_contrasts errors", { diff --git a/tests/testthat/test-dig_complement_contrasts.R b/tests/testthat/test-dig_complement_contrasts.R index 171ce16d..099960af 100644 --- a/tests/testthat/test-dig_complement_contrasts.R +++ b/tests/testthat/test-dig_complement_contrasts.R @@ -98,8 +98,7 @@ test_that("dig_complement_contrasts call args", { wilcox_tol_root = 1e-3, wilcox_digits_rank = 5, max_results = 5, - verbose = TRUE, - threads = 1)) + verbose = TRUE)) expect_true(is_nugget(res, flavour = "complement_contrasts")) expect_true(is_tibble(res)) @@ -137,7 +136,6 @@ test_that("dig_complement_contrasts call args", { expect_equal(attr(res, "call_args")$wilcox_digits_rank, 5) expect_equal(attr(res, "call_args")$max_results, 5) expect_equal(attr(res, "call_args")$verbose, TRUE) - expect_equal(attr(res, "call_args")$threads, 1L) }) test_that("dig_paired contrasts errors", { diff --git a/tests/testthat/test-dig_correlations.R b/tests/testthat/test-dig_correlations.R index acff342a..7b84f8fc 100644 --- a/tests/testthat/test-dig_correlations.R +++ b/tests/testthat/test-dig_correlations.R @@ -146,8 +146,7 @@ test_that("dig_correlations call args", { min_support = 0.1, max_support = 0.9, max_results = 100, - verbose = TRUE, - threads = 1)) + verbose = TRUE)) expect_true(is_nugget(res, flavour = "correlations")) expect_true(is_tibble(res)) expect_equal(attr(res, "call_function"), "dig_correlations") @@ -171,7 +170,6 @@ test_that("dig_correlations call args", { expect_equal(attr(res, "call_args")$max_support, 0.9) expect_equal(attr(res, "call_args")$max_results, 100) expect_equal(attr(res, "call_args")$verbose, TRUE) - expect_equal(attr(res, "call_args")$threads, 1) }) diff --git a/tests/testthat/test-dig_grid.R b/tests/testthat/test-dig_grid.R index c53d217d..411c399a 100644 --- a/tests/testthat/test-dig_grid.R +++ b/tests/testthat/test-dig_grid.R @@ -554,8 +554,7 @@ test_that("dig_grid call args", { min_support = 0.1, max_support = 0.9, max_results = 100L, - verbose = TRUE, - threads = 1L)) + verbose = TRUE)) expect_true(is_nugget(res)) expect_true(is_tibble(res)) @@ -580,7 +579,6 @@ test_that("dig_grid call args", { expect_equal(attr(res, "call_args")$max_support, 0.9) expect_equal(attr(res, "call_args")$max_results, 100L) expect_equal(attr(res, "call_args")$verbose, TRUE) - expect_equal(attr(res, "call_args")$threads, 1L) }) test_that("errors", { @@ -623,8 +621,6 @@ test_that("errors", { "`max_length` must be an integerish scalar") expect_error(dig_grid(d, f = fb, type = "crisp", condition = l, min_support = "x"), "`min_support` must be a double scalar") - expect_error(dig_grid(d, f = fb, type = "crisp", condition = l, threads = "x"), - "`threads` must be an integerish scalar") expect_error(dig_grid(d, f = fb, disjoint = list("x")), "`disjoint` must be a plain vector") diff --git a/tests/testthat/test-dig_paired_baseline_contrasts.R b/tests/testthat/test-dig_paired_baseline_contrasts.R index 73956142..68267f30 100644 --- a/tests/testthat/test-dig_paired_baseline_contrasts.R +++ b/tests/testthat/test-dig_paired_baseline_contrasts.R @@ -105,8 +105,8 @@ test_that("dig_paired_baseline_contrasts call args", { wilcox_tol_root = 1e-3, wilcox_digits_rank = 5, max_results = 100, - verbose = TRUE, - threads = 1)) + verbose = TRUE)) + expect_true(is_nugget(res, flavour = "paired_baseline_contrasts")) expect_true(is_tibble(res)) @@ -148,7 +148,6 @@ test_that("dig_paired_baseline_contrasts call args", { expect_equal(attr(res, "call_args")$wilcox_digits_rank, 5) expect_equal(attr(res, "call_args")$max_results, 100) expect_equal(attr(res, "call_args")$verbose, TRUE) - expect_equal(attr(res, "call_args")$threads, 1L) }) test_that("dig_paired contrasts errors", { diff --git a/tests/testthat/test-dig_tautologies.R b/tests/testthat/test-dig_tautologies.R index 9385431d..2fd79a1c 100644 --- a/tests/testthat/test-dig_tautologies.R +++ b/tests/testthat/test-dig_tautologies.R @@ -181,8 +181,7 @@ test_that("dig_tautologies argument forwarding and attributes", { min_confidence = 0.2, t_norm = "lukas", max_results = 5, - verbose = FALSE, - threads = 1 + verbose = FALSE ) ) @@ -235,6 +234,4 @@ test_that("dig_tautologies handles invalid arguments", { "`max_results` must be an integerish scalar.") expect_error(dig_tautologies(d, verbose = "x"), "`verbose` must be a flag.") - expect_error(dig_tautologies(d, threads = "x"), - "`threads` must be an integerish scalar.") }) From 3523350a0f6b9ad307dd3129575acb318128a4fc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 11:10:06 +0000 Subject: [PATCH 4/5] Fix deprecation when scope and check placement Co-authored-by: beerda <26056018+beerda@users.noreply.github.com> --- R/dig_associations.R | 20 ++++++++++---------- R/dig_baseline_contrasts.R | 12 ++++++------ R/dig_complement_contrasts.R | 12 ++++++------ R/dig_correlations.R | 12 ++++++------ R/dig_grid.R | 18 +++++++++--------- R/dig_paired_baseline_contrasts.R | 12 ++++++------ R/dig_tautologies.R | 12 ++++++------ 7 files changed, 49 insertions(+), 49 deletions(-) diff --git a/R/dig_associations.R b/R/dig_associations.R index 6b60a9d5..e346f267 100644 --- a/R/dig_associations.R +++ b/R/dig_associations.R @@ -212,22 +212,13 @@ dig_associations <- function(x, call = error_context$call) if (lifecycle::is_present(contingency_table)) { - deprecate_warn(when = "2.3.0", + deprecate_warn(when = "2.2.0", what = "nuggets::dig_associations(contingency_table)", details = "The `contingency_table` argument is deprecated and will be removed in future versions. dig_associations() works as 'contingency_table = TRUE' would be specified by default.") } else { contingency_table <- TRUE } - if (lifecycle::is_present(threads) && - (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { - deprecate_warn(when = "2.3.0", - what = "nuggets::dig_associations(threads)", - details = "The `threads` argument is deprecated and will be removed in future versions.") - } else if (!lifecycle::is_present(threads)) { - threads <- 1L - } - .must_be_flag(contingency_table, arg = error_context$arg_contingency_table, call = error_context$call) @@ -250,6 +241,15 @@ dig_associations <- function(x, antecedent <- enquo(antecedent) consequent <- enquo(consequent) + if (lifecycle::is_present(threads) && + (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { + deprecate_warn(when = "2.3.0", + what = "nuggets::dig_associations(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } else if (!lifecycle::is_present(threads)) { + threads <- 1L + } + res <- .dig(x = x, xname = deparse(substitute(x)), call_function = "dig_associations", diff --git a/R/dig_baseline_contrasts.R b/R/dig_baseline_contrasts.R index a76062e5..7195000c 100644 --- a/R/dig_baseline_contrasts.R +++ b/R/dig_baseline_contrasts.R @@ -193,12 +193,6 @@ dig_baseline_contrasts <- function(x, .must_be_double_scalar(wilcox_tol_root) .must_be_double_scalar(wilcox_digits_rank) - if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.3.0", - what = "nuggets::dig_baseline_contrasts(threads)", - details = "The `threads` argument is deprecated and will be removed in future versions.") - } - condition <- enquo(condition) vars <- enquo(vars) @@ -232,6 +226,12 @@ dig_baseline_contrasts <- function(x, stop("Internal error - unknown method: ", method) } + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.3.0", + what = "nuggets::dig_baseline_contrasts(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + res <- dig_grid(x = x, f = f, condition = !!condition, diff --git a/R/dig_complement_contrasts.R b/R/dig_complement_contrasts.R index 3199abca..cdc1a4f6 100644 --- a/R/dig_complement_contrasts.R +++ b/R/dig_complement_contrasts.R @@ -209,12 +209,6 @@ dig_complement_contrasts <- function(x, .must_be_double_scalar(wilcox_tol_root) .must_be_double_scalar(wilcox_digits_rank) - if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.3.0", - what = "nuggets::dig_complement_contrasts(threads)", - details = "The `threads` argument is deprecated and will be removed in future versions.") - } - condition <- enquo(condition) vars <- enquo(vars) @@ -259,6 +253,12 @@ dig_complement_contrasts <- function(x, stop("Internal error - unknown method: ", method) } + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.3.0", + what = "nuggets::dig_complement_contrasts(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + res <- dig_grid(x = x, f = f, condition = !!condition, diff --git a/R/dig_correlations.R b/R/dig_correlations.R index be4127eb..71f39ff6 100644 --- a/R/dig_correlations.R +++ b/R/dig_correlations.R @@ -140,12 +140,6 @@ dig_correlations <- function(x, .must_be_enum(alternative, c("two.sided", "less", "greater")) .must_be_flag(exact, null = TRUE) - if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.3.0", - what = "nuggets::dig_correlations(threads)", - details = "The `threads` argument is deprecated and will be removed in future versions.") - } - condition <- enquo(condition) xvars <- enquo(xvars) yvars <- enquo(yvars) @@ -163,6 +157,12 @@ dig_correlations <- function(x, n = nrow(pd))) } + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.3.0", + what = "nuggets::dig_correlations(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + res <- dig_grid(x = x, f = f, condition = !!condition, diff --git a/R/dig_grid.R b/R/dig_grid.R index ccda0829..6286c228 100644 --- a/R/dig_grid.R +++ b/R/dig_grid.R @@ -244,15 +244,6 @@ dig_grid <- function(x, call = error_context$call) } - if (lifecycle::is_present(threads) && - (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { - deprecate_warn(when = "2.3.0", - what = "nuggets::dig_grid(threads)", - details = "The `threads` argument is deprecated and will be removed in future versions.") - } else if (!lifecycle::is_present(threads)) { - threads <- 1L - } - condition <- enquo(condition) cols <- .convert_data_to_list(x, error_context = error_context) @@ -345,6 +336,15 @@ dig_grid <- function(x, callbackF <- tempF3 } + if (lifecycle::is_present(threads) && + (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { + deprecate_warn(when = "2.3.0", + what = "nuggets::dig_grid(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } else if (!lifecycle::is_present(threads)) { + threads <- 1L + } + res <- dig(x = x, f = callbackF, condition = !!condition, diff --git a/R/dig_paired_baseline_contrasts.R b/R/dig_paired_baseline_contrasts.R index 96dafd08..74ffc9ee 100644 --- a/R/dig_paired_baseline_contrasts.R +++ b/R/dig_paired_baseline_contrasts.R @@ -218,12 +218,6 @@ dig_paired_baseline_contrasts <- function(x, .must_be_double_scalar(wilcox_tol_root) .must_be_double_scalar(wilcox_digits_rank) - if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.3.0", - what = "nuggets::dig_paired_baseline_contrasts(threads)", - details = "The `threads` argument is deprecated and will be removed in future versions.") - } - condition <- enquo(condition) xvars <- enquo(xvars) yvars <- enquo(yvars) @@ -259,6 +253,12 @@ dig_paired_baseline_contrasts <- function(x, stop("Internal error - unknown method: ", method) } + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.3.0", + what = "nuggets::dig_paired_baseline_contrasts(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + res <- dig_grid(x = x, f = f, condition = !!condition, diff --git a/R/dig_tautologies.R b/R/dig_tautologies.R index df44124b..630986fc 100644 --- a/R/dig_tautologies.R +++ b/R/dig_tautologies.R @@ -108,12 +108,6 @@ dig_tautologies <- function(x, .must_be_integerish_scalar(max_results) .must_be_greater_eq(max_results, 1) - if (lifecycle::is_present(threads)) { - deprecate_warn(when = "2.3.0", - what = "nuggets::dig_tautologies(threads)", - details = "The `threads` argument is deprecated and will be removed in future versions.") - } - antecedent <- enquo(antecedent) consequent <- enquo(consequent) tautologies <- list() @@ -133,6 +127,12 @@ dig_tautologies <- function(x, max_length <- sum(ante_cols$selected) } + if (lifecycle::is_present(threads)) { + deprecate_warn(when = "2.3.0", + what = "nuggets::dig_tautologies(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } + digattr <- NULL while (len <= max_length) { maxres <- max_results From 0ff93b635fb5b31169212ca8d79034b4e8f0c68f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 11:13:28 +0000 Subject: [PATCH 5/5] Deprecate threads in dig function Co-authored-by: beerda <26056018+beerda@users.noreply.github.com> --- R/dig.R | 13 +++++++++++-- R/dig_grid.R | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/R/dig.R b/R/dig.R index 3dffd85d..896634f7 100644 --- a/R/dig.R +++ b/R/dig.R @@ -178,7 +178,7 @@ #' is reached, generation of further conditions stops. Use a positive #' integer to enable early stopping; set to `Inf` to remove the cap. #' @param verbose Logical; if `TRUE`, print progress messages. -#' @param threads Number of threads for parallel computation. +#' @param threads (Deprecated.) Number of threads for parallel computation. #' @param error_context A list of details to be used when constructing error #' messages. This is mainly useful when `dig()` is called from another #' function and errors should refer to the caller’s argument names rather @@ -281,7 +281,7 @@ dig <- function(x, t_norm = "goguen", max_results = Inf, verbose = FALSE, - threads = 1L, + threads = deprecated(), error_context = list(arg_x = "x", arg_f = "f", arg_condition = "condition", @@ -316,6 +316,15 @@ dig <- function(x, do.call(f, l) } + if (lifecycle::is_present(threads) && + (is.null(error_context$deprecate_threads) || isTRUE(error_context$deprecate_threads))) { + deprecate_warn(when = "2.3.0", + what = "nuggets::dig(threads)", + details = "The `threads` argument is deprecated and will be removed in future versions.") + } else if (!lifecycle::is_present(threads)) { + threads <- 1L + } + .dig(x = x, xname = deparse(substitute(x)), call_function = "dig", diff --git a/R/dig_grid.R b/R/dig_grid.R index 6286c228..d8ae9188 100644 --- a/R/dig_grid.R +++ b/R/dig_grid.R @@ -368,6 +368,7 @@ dig_grid <- function(x, arg_max_results = error_context$arg_max_results, arg_verbose = error_context$arg_verbose, arg_threads = error_context$arg_threads, + deprecate_threads = FALSE, call = error_context$call)) digattr <- attributes(res) res <- do.call(bind_rows, res)