From d9a310cbe20230e8de505e459489adbfda481ce9 Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 12:27:51 +0000 Subject: [PATCH 01/12] feat: Adds functions enable_suppression() and disable_suppression() --- R/acro_init.R | 2 +- R/output_commands.R | 27 +++++++++++++++++++ .../testthat/test-acro_disable_suppression.R | 14 ++++++++++ tests/testthat/test-acro_enable_suppression.R | 14 ++++++++++ tests/testthat/test-acro_pivot_table.R | 7 +++-- 5 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/test-acro_disable_suppression.R create mode 100644 tests/testthat/test-acro_enable_suppression.R diff --git a/R/acro_init.R b/R/acro_init.R index 327255e..465ddbd 100644 --- a/R/acro_init.R +++ b/R/acro_init.R @@ -1,6 +1,6 @@ # Globals ----------------------------------------------------------------- acro_venv <- "r-acro" -acro_pkg <- "acro==0.4.11" +acro_pkg <- "acro==0.4.12" ch <- "conda-forge" diff --git a/R/output_commands.R b/R/output_commands.R index 4fcb4c6..fe7ad35 100644 --- a/R/output_commands.R +++ b/R/output_commands.R @@ -98,3 +98,30 @@ acro_finalise <- function(path, ext) { } acroEnv$ac$finalise(path, ext) } + + +#' Turns suppresssion on during a session +#' +#' @return No return value, called for side effects +#' @export + +acro_enable_suppression <- function() { + if (is.null(acroEnv$ac)) { + stop("ACRO has not been initialised. Please first call acro_init().") + } + acroEnv$ac$enable_suppression() +} + +#' Turns suppresssion off during a session +#' +#' @return No return value, called for side effects +#' @export + +acro_disable_suppression <- function() { + if (is.null(acroEnv$ac)) { + stop("ACRO has not been initialised. Please first call acro_init().") + } + acroEnv$ac$disable_suppression() +} + + diff --git a/tests/testthat/test-acro_disable_suppression.R b/tests/testthat/test-acro_disable_suppression.R new file mode 100644 index 0000000..2d2477e --- /dev/null +++ b/tests/testthat/test-acro_disable_suppression.R @@ -0,0 +1,14 @@ +test_that("acro_enable_suppression without initialising ACRO object first", { + acroEnv$ac <- NULL + expect_error(acro_disable_suppression(), "ACRO has not been initialised. Please first call acro_init()") +}) + +test_that("acro_disable_suppression works", { + testthat::skip_on_cran() + acro_init() + foo <- acro_disable_suppression() + table <- acro_crosstab(index = nursery_data[, c("recommend")], columns = nursery_data[, c("parents")]) + output <- acro_print_outputs() + status <- "fail" + expect_true(any(grepl(status, output))) +}) diff --git a/tests/testthat/test-acro_enable_suppression.R b/tests/testthat/test-acro_enable_suppression.R new file mode 100644 index 0000000..08536fa --- /dev/null +++ b/tests/testthat/test-acro_enable_suppression.R @@ -0,0 +1,14 @@ +test_that("acro_enable_suppression without initialising ACRO object first", { + acroEnv$ac <- NULL + expect_error(acro_enable_suppression()(), "ACRO has not been initialised. Please first call acro_init()") +}) + +test_that("acro_enable_suppression works", { + testthat::skip_on_cran() + acro_init() + acro_enable_suppression() + table <- acro_crosstab(index = nursery_data[, c("recommend")], columns = nursery_data[, c("parents")]) + output <- acro_print_outputs() + status <- "review" + expect_true(any(grepl(status, output))) +}) diff --git a/tests/testthat/test-acro_pivot_table.R b/tests/testthat/test-acro_pivot_table.R index 4331bde..255c6d1 100644 --- a/tests/testthat/test-acro_pivot_table.R +++ b/tests/testthat/test-acro_pivot_table.R @@ -6,8 +6,10 @@ test_that("acro_pivot_table without initialising ACRO object first", { test_that("acro_pivot_table works", { testthat::skip_on_cran() expected_table <- data.frame( - "('mean', 'children')" = c(3.272222, 3.242593, 3.241667), - "('std', 'children')" = c(2.48458394, 2.43848908, 2.42963966), +# "(mean', 'children')" = c(3.272222, 3.242593, 3.241667), +# "('std', 'children')" = c(2.48458394, 2.43848908, 2.42963966), + "mean children" = c(3.272222, 3.242593, 3.241667), + "std children" = c(2.48458394, 2.43848908, 2.42963966), check.names = FALSE ) @@ -17,6 +19,7 @@ test_that("acro_pivot_table works", { acro_init() table <- acro_pivot_table(data = nursery_data, index = "parents", values = "children", aggfunc = list("mean", "std")) + print( table) print(expected_table) expect_equal(table[, -1, drop = FALSE], expected_table[, -1, drop = FALSE]) }) From 2ab4ba096f46514b0bf4eeafa01e773db83b02d2 Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 12:46:17 +0000 Subject: [PATCH 02/12] cleaning code --- tests/testthat/test-acro_pivot_table.R | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-acro_pivot_table.R b/tests/testthat/test-acro_pivot_table.R index 255c6d1..ea43e11 100644 --- a/tests/testthat/test-acro_pivot_table.R +++ b/tests/testthat/test-acro_pivot_table.R @@ -6,10 +6,8 @@ test_that("acro_pivot_table without initialising ACRO object first", { test_that("acro_pivot_table works", { testthat::skip_on_cran() expected_table <- data.frame( -# "(mean', 'children')" = c(3.272222, 3.242593, 3.241667), -# "('std', 'children')" = c(2.48458394, 2.43848908, 2.42963966), - "mean children" = c(3.272222, 3.242593, 3.241667), - "std children" = c(2.48458394, 2.43848908, 2.42963966), + "('mean', 'children')" = c(3.272222, 3.242593, 3.241667), + "('std', 'children')" = c(2.48458394, 2.43848908, 2.42963966), check.names = FALSE ) @@ -19,7 +17,5 @@ test_that("acro_pivot_table works", { acro_init() table <- acro_pivot_table(data = nursery_data, index = "parents", values = "children", aggfunc = list("mean", "std")) - print( table) - print(expected_table) expect_equal(table[, -1, drop = FALSE], expected_table[, -1, drop = FALSE]) }) From 2734dfb047f3ed6fc834b58bf4da0b76026badb1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 12:54:31 +0000 Subject: [PATCH 03/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- R/output_commands.R | 2 -- tests/testthat/test-acro_disable_suppression.R | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/R/output_commands.R b/R/output_commands.R index fe7ad35..74a8010 100644 --- a/R/output_commands.R +++ b/R/output_commands.R @@ -123,5 +123,3 @@ acro_disable_suppression <- function() { } acroEnv$ac$disable_suppression() } - - diff --git a/tests/testthat/test-acro_disable_suppression.R b/tests/testthat/test-acro_disable_suppression.R index 2d2477e..365c733 100644 --- a/tests/testthat/test-acro_disable_suppression.R +++ b/tests/testthat/test-acro_disable_suppression.R @@ -6,7 +6,7 @@ test_that("acro_enable_suppression without initialising ACRO object first", { test_that("acro_disable_suppression works", { testthat::skip_on_cran() acro_init() - foo <- acro_disable_suppression() + foo <- acro_disable_suppression() table <- acro_crosstab(index = nursery_data[, c("recommend")], columns = nursery_data[, c("parents")]) output <- acro_print_outputs() status <- "fail" From e4e14c61bee0c3586ad018ae99dc77b5df8c28cb Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 13:13:10 +0000 Subject: [PATCH 04/12] adding files tweaked by rcheck --- NAMESPACE | 2 ++ R/output_commands.R | 4 ++-- inst/WORDLIST | 20 +++++++------------- man/acro_disable_suppression.Rd | 14 ++++++++++++++ man/acro_enable_suppression.Rd | 14 ++++++++++++++ vignettes/supports.Rmd | 2 +- 6 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 man/acro_disable_suppression.Rd create mode 100644 man/acro_enable_suppression.Rd diff --git a/NAMESPACE b/NAMESPACE index ddeb349..4d2998a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,6 +4,8 @@ export(acro_add_comments) export(acro_add_exception) export(acro_crosstab) export(acro_custom_output) +export(acro_disable_suppression) +export(acro_enable_suppression) export(acro_finalise) export(acro_glm) export(acro_hist) diff --git a/R/output_commands.R b/R/output_commands.R index 74a8010..ad91e39 100644 --- a/R/output_commands.R +++ b/R/output_commands.R @@ -100,7 +100,7 @@ acro_finalise <- function(path, ext) { } -#' Turns suppresssion on during a session +#' Turns suppression on during a session #' #' @return No return value, called for side effects #' @export @@ -112,7 +112,7 @@ acro_enable_suppression <- function() { acroEnv$ac$enable_suppression() } -#' Turns suppresssion off during a session +#' Turns suppression off during a session #' #' @return No return value, called for side effects #' @export diff --git a/inst/WORDLIST b/inst/WORDLIST index 93cbbdf..47df252 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,41 +1,35 @@ ADR Acknowledgement Analytics +Conda EPSRC -GPLv GRAIMATTER HDR Initialise Karnofsky MRC MyBinder -NK -PyPI RStudio SACRO SDC -Scalable -TRE +TREs +TREvolution +Transformative Xplore +YAML +analytics auditable -btn codecov -crosstab disclosive -finalise github https initialised json -mitigations numpy openml -organisation pre programme -sacro scipy -sm -statsmodels www xlsx +yaml diff --git a/man/acro_disable_suppression.Rd b/man/acro_disable_suppression.Rd new file mode 100644 index 0000000..2f77a76 --- /dev/null +++ b/man/acro_disable_suppression.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/output_commands.R +\name{acro_disable_suppression} +\alias{acro_disable_suppression} +\title{Turns suppression off during a session} +\usage{ +acro_disable_suppression() +} +\value{ +No return value, called for side effects +} +\description{ +Turns suppression off during a session +} diff --git a/man/acro_enable_suppression.Rd b/man/acro_enable_suppression.Rd new file mode 100644 index 0000000..2ca6dbe --- /dev/null +++ b/man/acro_enable_suppression.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/output_commands.R +\name{acro_enable_suppression} +\alias{acro_enable_suppression} +\title{Turns suppression on during a session} +\usage{ +acro_enable_suppression() +} +\value{ +No return value, called for side effects +} +\description{ +Turns suppression on during a session +} diff --git a/vignettes/supports.Rmd b/vignettes/supports.Rmd index 5a2e0fb..25de22c 100644 --- a/vignettes/supports.Rmd +++ b/vignettes/supports.Rmd @@ -4,7 +4,7 @@ title: "What ACRO-R Supports" # What ACRO-R Supports -This page provides a comprehensive overview of ACRO’s capabilities. ACRO supports a wide range of statistical analysis functions with automated disclosure control. +This page provides a comprehensive overview of the capabilities ACRO supports. ACRO supports a wide range of statistical analysis functions with automated disclosure control. ## Supported Data Analysis Functions From 97517377abc00ec6f722c445a992579e71dce4f6 Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 13:37:56 +0000 Subject: [PATCH 05/12] updated news --- DESCRIPTION | 2 +- NEWS.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index dae5bc7..1290a52 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: acro Title: A Tool for Semi-Automating the Statistical Disclosure Control of Research Outputs -Version: 0.1.6 +Version: 0.1.7 Authors@R: c( person("Jim", "Smith", role = c("cre","ctb"), email = "James.Smith@uwe.ac.uk", comment = c(ORCID = "0000-0001-7908-1859")), diff --git a/NEWS.md b/NEWS.md index 53f8d56..295fac6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +# acro 0.1.7 +* Added support for installation via conda +* Added support for specifying config files when acro session is started +* Added support for specifying whether suppression is on or off when acro session is started +* Added support for toggling suppression dynamically during session via ```acro_enable_supression()``` + and ```acro_disable_suppression()``` +* Improved documentation in package and at [sacro-tools.org](sacro-tools.org) +* AddedSupport for variable names with spaces when calling crosstab +* Set status of disclosive outputs to 'review' (previously 'fail') when suppression has been applied +* Automatically add exception message when applying suppression to an output +* Make ```acro_finalise()``` non-interactive by default (interactive is now option at call time) + # acro 0.1.6 * Upgrade ACRO Python backend to v0.4.11, supporting Python 3.14. From 50f38754888c4562cacc0ceea7e2c2e1db5bd32a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 13:38:24 +0000 Subject: [PATCH 06/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- NEWS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 295fac6..2ad0d0d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,13 +3,13 @@ * Added support for specifying config files when acro session is started * Added support for specifying whether suppression is on or off when acro session is started * Added support for toggling suppression dynamically during session via ```acro_enable_supression()``` - and ```acro_disable_suppression()``` -* Improved documentation in package and at [sacro-tools.org](sacro-tools.org) + and ```acro_disable_suppression()``` +* Improved documentation in package and at [sacro-tools.org](sacro-tools.org) * AddedSupport for variable names with spaces when calling crosstab * Set status of disclosive outputs to 'review' (previously 'fail') when suppression has been applied * Automatically add exception message when applying suppression to an output * Make ```acro_finalise()``` non-interactive by default (interactive is now option at call time) - + # acro 0.1.6 * Upgrade ACRO Python backend to v0.4.11, supporting Python 3.14. From 89693e4d4c15bbcfbc73122582517ffb3ae95253 Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 14:16:49 +0000 Subject: [PATCH 07/12] adding rhub commands to pre-submission-check --- inst/WORDLIST | 4 ++++ prepare_to_submit_to_CRAN.R | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/inst/WORDLIST b/inst/WORDLIST index 47df252..fe1d61c 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,5 +1,6 @@ ADR Acknowledgement +AddedSupport Analytics Conda EPSRC @@ -20,6 +21,9 @@ YAML analytics auditable codecov +conda +config +crosstab disclosive github https diff --git a/prepare_to_submit_to_CRAN.R b/prepare_to_submit_to_CRAN.R index f376ad7..7718589 100644 --- a/prepare_to_submit_to_CRAN.R +++ b/prepare_to_submit_to_CRAN.R @@ -23,7 +23,7 @@ devtools::test() spelling::spell_check_package() # check your package on several platforms -# rhub::check_for_cran() +rhub::check_for_cran() # If you would like to add comments to CRAN team # Creates cran-comments.md, a template for your communications with CRAN when submitting a package. From 5925943da5823c08fe42def8c8833169d9b8fc56 Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 14:28:12 +0000 Subject: [PATCH 08/12] commented out old version of rhub --- prepare_to_submit_to_CRAN.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prepare_to_submit_to_CRAN.R b/prepare_to_submit_to_CRAN.R index 7718589..36e5119 100644 --- a/prepare_to_submit_to_CRAN.R +++ b/prepare_to_submit_to_CRAN.R @@ -23,7 +23,7 @@ devtools::test() spelling::spell_check_package() # check your package on several platforms -rhub::check_for_cran() +#rhub::check_for_cran() # If you would like to add comments to CRAN team # Creates cran-comments.md, a template for your communications with CRAN when submitting a package. From 6c26432688a407f84750f96160fbd91b9514f33c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 14:28:43 +0000 Subject: [PATCH 09/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- prepare_to_submit_to_CRAN.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prepare_to_submit_to_CRAN.R b/prepare_to_submit_to_CRAN.R index 36e5119..f376ad7 100644 --- a/prepare_to_submit_to_CRAN.R +++ b/prepare_to_submit_to_CRAN.R @@ -23,7 +23,7 @@ devtools::test() spelling::spell_check_package() # check your package on several platforms -#rhub::check_for_cran() +# rhub::check_for_cran() # If you would like to add comments to CRAN team # Creates cran-comments.md, a template for your communications with CRAN when submitting a package. From 99ebe03febe64da62f3c4d2427deffc699ed761d Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 15:43:41 +0000 Subject: [PATCH 10/12] fixing typos and quote levels in markdown --- DESCRIPTION | 2 +- NEWS.md | 10 ++++++---- inst/WORDLIST | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1290a52..dbe9979 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: acro Title: A Tool for Semi-Automating the Statistical Disclosure Control of Research Outputs -Version: 0.1.7 +Version: 0.1.8 Authors@R: c( person("Jim", "Smith", role = c("cre","ctb"), email = "James.Smith@uwe.ac.uk", comment = c(ORCID = "0000-0001-7908-1859")), diff --git a/NEWS.md b/NEWS.md index 2ad0d0d..c02cc41 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,14 +1,16 @@ +# acro 0.1.8 + # acro 0.1.7 * Added support for installation via conda * Added support for specifying config files when acro session is started * Added support for specifying whether suppression is on or off when acro session is started -* Added support for toggling suppression dynamically during session via ```acro_enable_supression()``` - and ```acro_disable_suppression()``` +* Added support for toggling suppression dynamically during session via `acro_enable_supression()` + and `acro_disable_suppression()` * Improved documentation in package and at [sacro-tools.org](sacro-tools.org) -* AddedSupport for variable names with spaces when calling crosstab +* Added Support for variable names with spaces when calling crosstab * Set status of disclosive outputs to 'review' (previously 'fail') when suppression has been applied * Automatically add exception message when applying suppression to an output -* Make ```acro_finalise()``` non-interactive by default (interactive is now option at call time) +* Make `acro_finalise()` non-interactive by default (interactive is now option at call time) # acro 0.1.6 diff --git a/inst/WORDLIST b/inst/WORDLIST index fe1d61c..8382203 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,6 +1,5 @@ ADR Acknowledgement -AddedSupport Analytics Conda EPSRC From 88277ef5634cda65acb9b0902173d18b0cf19c08 Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 15:50:09 +0000 Subject: [PATCH 11/12] version should be 1.7 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index dbe9979..1290a52 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: acro Title: A Tool for Semi-Automating the Statistical Disclosure Control of Research Outputs -Version: 0.1.8 +Version: 0.1.7 Authors@R: c( person("Jim", "Smith", role = c("cre","ctb"), email = "James.Smith@uwe.ac.uk", comment = c(ORCID = "0000-0001-7908-1859")), From 9d49e3a3a718dee7141b9bb585b3e6a37a2bde08 Mon Sep 17 00:00:00 2001 From: Jim-smith Date: Mon, 2 Feb 2026 15:51:17 +0000 Subject: [PATCH 12/12] Remove version 0.1.8 entry from NEWS.md Signed-off-by: Jim-smith --- NEWS.md | 1 - 1 file changed, 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index c02cc41..00dd141 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,3 @@ -# acro 0.1.8 # acro 0.1.7 * Added support for installation via conda