Skip to content

Commit ddb5da0

Browse files
rpreenJessUWE
andauthored
docs: add documentation (#30)
* Create index.md for Acro-R Add documentation for ACRO and SACRO tools with features and installation instructions. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Revise installation guide for ACRO and SACRO tools Updated the installation guide to include installation instructions for the ACRO package from CRAN and GitHub, along with core features and prerequisites. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Add comprehensive overview of ACRO's capabilities This document outlines the capabilities of ACRO, including supported data analysis functions, programming languages, disclosure control features, and integration capabilities. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Add welcome documentation for ACRO-R package This file provides an overview of the ACRO-R package, its purpose, usage, and acknowledgments. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Create examples.md with usage and tutorials for ACRO Added examples and tutorials for using ACRO in R. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Add files via upload Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Added the SACRO_Logo to the figures folder Created a figures folder to hold the SACRO_Logo within the Man folder Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Enhance pkgdown configuration with light-switch Added light-switch feature and updated navbar structure. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * CSS and JS for custom styling Created vanilla CSS and JS files to style the documentation page and lightswitch feature. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Simplify pkgdown workflow configuration Removed concurrency restrictions and environment variables from pkgdown workflow. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Fix link for SACRO-Viewer documentation Updated the link for SACRO-Viewer documentation. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update links for ACRO and SACRO-ML tools Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update output formats in supports.md Removed PDF reports and HTML summaries from output formats. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Enable building vignettes in R package check Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Fix merging issues Fix merging issues and CRAN * Update .gitignore and DESCRIPTION for improved documentation and output management. Fixed broken links to documentation; ACRO.sacro-tools.org SACRO-ML.sacro-tools.org ACRO-R.sacro-tools.org SACRO-Viewer.sacro-tools.org * Refactor R-CMD-check workflow configuration Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update pre-commit configuration, fix links in documentation, and update DESCRIPTION for Roxygen version Update pre-commit configuration, fix links in documentation, and update DESCRIPTION for Roxygen version * Remove unnecessary trailing whitespace from various HTML and JavaScript files in the documentation. * Remove unnecessary trailing whitespace from various HTML and JavaScript files in the documentation. * Change Python requirement to version 3.10 or higher Updated Python version requirement from 3.8 to 3.10. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Delete .vscode directory Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Delete docs directory Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Delete .RData Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Add additional entries to .Rbuildignore Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update WORDLIST with additional terms Added new terms related to software and data analysis. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Change Python version for old R versions in CI Updated Python version from 3.9 to 3.10 for old R versions in CI workflow. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Fix YAML formatting in R-CMD-check workflow Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Comment out the R Package check step in the CI workflow * Remove unnecessary blank line in R-CMD-check workflow * Build vignettes and documentation * Uncomment R Package check step in workflow Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Build vignettes and documentation * Add skip_on_ci() to tests and fix workflow * Replace skip_on_cran() with skip_on_ci() in tests for acro_crosstab and acro_custom_output * Fix formatting issues in test-acro_crosstab.R Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update tests for acro_glm with skip_on_ci Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Fixed errors in the files as well as warnings. fix vignette issues and updated the R-CMD-check file * fixed r-cmd-check and warnings from the test files * Update R-CMD-check.yaml Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update R-CMD-check.yaml Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update create_virtualenv.R Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * fix errors and warnings, hopefully it works this time, made adjustment to the install_acro file as well as the r file * Update create_virtualenv.R Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Updated virtualenv * cleaned code to meet codecav * fixed The roxygen comments in your R code are being converted to an invalid * added a new test file * fixed pre commit issues * . * Update create_virtualenv.R Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update test-create_virtualenv.R Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * . * . * Delete vignettes/.example-notebook.Rmd.swp Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update index.md Added https to the SACRO-ML link Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Replace skip_on_ci() with skip_on_cran() in tests for acro_crosstab and acro_custom_output * Moved the NEWS.md file to the right position * Update test-acro_glm.R Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update R-CMD-check.yaml Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update R-CMD-check.yaml I've removed the - name: Install Python ACRO step that was running python -m pip install acro Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> --------- Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> Co-authored-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk>
1 parent 3ecc3dd commit ddb5da0

23 files changed

Lines changed: 580 additions & 48 deletions

.Rbuildignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@
1515
^data/nursery\.arff$
1616
^data/charity\.dta$
1717
^prepare_to_submit_to_CRAN\.R$
18+
^pkgdown$
19+
^index\.md$
20+
^examples\.md$
21+
^installation\.md$
22+
^supports\.md$
23+
^welcome\.md$
24+
^\.vscode$
25+
^.*\.swp$
26+
^\.Rdata$
27+
^doc$
28+
^Meta$

.github/workflows/R-CMD-check.yaml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,45 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2-
# Need help debugging build failures?
3-
# Start at https://github.com/r-lib/actions#where-to-find-help
41
on:
52
push:
63
branches: [main, master]
74
pull_request:
85
branches: [main, master]
9-
106
name: R-CMD-check
11-
127
jobs:
138
R-CMD-check:
149
runs-on: ${{ matrix.os }}
15-
1610
name: ${{ matrix.os }} (${{ matrix.r }})
17-
1811
strategy:
1912
fail-fast: false
2013
matrix:
2114
include:
22-
23-
# default everything
24-
- {os: 'ubuntu-latest', python: '3.13', r: 'release'}
25-
- {os: 'windows-latest', python: '3.13', r: 'release'}
26-
- {os: 'macOS-latest', python: '3.13', r: 'release'}
27-
28-
# older R versions
29-
- {os: 'ubuntu-latest', python: '3.9', r: 'oldrel-1'}
30-
- {os: 'ubuntu-latest', python: '3.9', r: 'oldrel-2'}
31-
- {os: 'ubuntu-latest', python: '3.9', r: 'oldrel-3'}
32-
15+
- { os: "ubuntu-latest", python: "3.13", r: "release" }
16+
- { os: "windows-latest", python: "3.13", r: "release" }
17+
- { os: "macOS-latest", python: "3.13", r: "release" }
18+
- { os: "ubuntu-latest", python: "3.10", r: "oldrel-1" }
19+
- { os: "ubuntu-latest", python: "3.10", r: "oldrel-2" }
20+
- { os: "ubuntu-latest", python: "3.10", r: "oldrel-3" }
3321
env:
3422
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3523
R_KEEP_PKG_SOURCE: yes
36-
# set matplotlib backend because Windows CI errors with:
37-
# "This probably means that Tcl wasn't installed properly."
38-
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
39-
24+
MPLBACKEND: Agg
4025
steps:
4126
- name: Checkout ACRO
42-
uses: actions/checkout@v5
43-
27+
uses: actions/checkout@v4
4428
- name: Setup Python
4529
uses: actions/setup-python@v6
4630
with:
4731
python-version: ${{ matrix.python }}
48-
4932
- name: Setup pandoc
5033
uses: r-lib/actions/setup-pandoc@v2
51-
5234
- name: Setup R
5335
uses: r-lib/actions/setup-r@v2
5436
with:
5537
r-version: ${{ matrix.r }}
56-
5738
- name: Install R dependencies
5839
uses: r-lib/actions/setup-r-dependencies@v2
5940
with:
6041
extra-packages: any::rcmdcheck
6142
needs: check
62-
6343
- name: Check R Package
6444
uses: r-lib/actions/check-r-package@v2
6545
with:

.github/workflows/pkgdown.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ jobs:
1414
pkgdown:
1515
runs-on: ubuntu-latest
1616

17-
concurrency: # restrict concurrency for non-PR jobs
18-
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
19-
20-
env:
21-
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22-
2317
steps:
2418
- name: Checkout
2519
uses: actions/checkout@v5

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,6 @@ stata/various_stata_development__files
148148
# test output
149149
/outputs/
150150
/test.xlsx
151+
inst/doc
152+
/doc/
153+
/Meta/

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ repos:
3434
(?x)^(
3535
.*\.txt|
3636
.*\.ipynb|
37-
.*\.html
37+
.*\.html|
38+
docs/deps/.*
3839
)$
3940
4041
# Format R files

DESCRIPTION

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Description: A Tool for Semi-Automating the Statistical Disclosure Control of Re
1313
License: MIT + file LICENSE
1414
Encoding: UTF-8
1515
Roxygen: list(markdown = TRUE)
16-
RoxygenNote: 7.3.2
16+
RoxygenNote: 7.3.3
1717
SystemRequirements: Python (>= 3.10)
1818
Imports:
1919
reticulate,
@@ -23,9 +23,12 @@ Depends:
2323
R (>= 2.10)
2424
LazyData: true
2525
Suggests:
26+
knitr,
27+
rmarkdown,
2628
spelling,
2729
testthat (>= 3.0.0)
2830
Config/testthat/edition: 3
2931
Language: en-US
3032
URL: https://github.com/AI-SDC/ACRO-R
3133
BugReports: https://github.com/AI-SDC/ACRO-R/issues
34+
VignetteBuilder: knitr

R/create_virtualenv.R

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,29 @@ acro_venv <- "r-acro"
22
acro_package <- "acro==0.4.11"
33
python_version <- ">=3.10"
44

5-
65
#' Install acro
76
#'
87
#' @param envname the name of the Python virtual environment
8+
#' @param python the path to Python executable
99
#' @param ... Any other parameters.
1010
#'
1111
#' @return No return value, called for side effects
12+
install_acro <- function(envname = "r-acro", python = NULL, ...) {
13+
# Get Python executable if not provided
14+
if (is.null(python)) {
15+
python <- Sys.which("python3")
16+
if (python == "") {
17+
python <- Sys.which("python") # nocov
18+
if (python == "") { # nocov
19+
stop("Python not found in PATH. Please ensure Python is installed and accessible.") # nocov
20+
} # nocov
21+
}
22+
}
1223

13-
14-
install_acro <- function(envname = "r-acro", ...) {
1524
# create Python virtual environment
1625
reticulate::virtualenv_create(
1726
envname = envname,
18-
version = python_version,
27+
python = python,
1928
force = TRUE,
2029
packages = NULL
2130
)
@@ -29,11 +38,16 @@ install_acro <- function(envname = "r-acro", ...) {
2938
#' @param ... Any other parameters.
3039
#'
3140
#' @return No return value, called for side effects
32-
3341
create_virtualenv <- function(...) {
42+
# Get Python executable path
43+
python_path <- Sys.which("python3")
44+
if (python_path == "") {
45+
python_path <- Sys.which("python") # nocov
46+
}
47+
3448
# ensure a virtual environment exists
3549
if (!reticulate::virtualenv_exists(acro_venv)) {
36-
install_acro(envname = acro_venv)
50+
install_acro(envname = acro_venv, python = python_path)
3751
}
3852

3953
# activate virtual environment

_pkgdown.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1-
---
2-
url: https://AI-SDC.github.io/ACRO-R/
31
template:
2+
light-switch: true
43
bootstrap: 5
5-
...
4+
bslib:
5+
primary: "#0051a5"
6+
7+
navbar:
8+
structure:
9+
left: [home, reference, welcome, supports, installation, examples]
10+
right: [search, github, lightswitch]
11+
left:
12+
- text: "Home"
13+
href: index.html
14+
- text: "Reference"
15+
href: reference/index.html
16+
- text: "Welcome to ACRO-R"
17+
href: welcome.html
18+
- text: "What ACRO-R Supports"
19+
href: supports.html
20+
- text: "Installation"
21+
href: installation.html
22+
- text: "Examples"
23+
href: examples.html
24+
right:
25+
- icon: fab-github
26+
href: https://github.com/AI-SDC/ACRO-R
27+
aria-label: GitHub

inst/WORDLIST

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,40 @@ ADR
22
Acknowledgement
33
Analytics
44
EPSRC
5+
GPLv
56
GRAIMATTER
67
HDR
78
Initialise
89
Karnofsky
910
MRC
1011
MyBinder
12+
NK
13+
PyPI
1114
RStudio
1215
SACRO
1316
SDC
17+
Scalable
18+
TRE
1419
Xplore
1520
auditable
21+
btn
1622
codecov
23+
crosstab
1724
disclosive
25+
finalise
1826
github
1927
https
2028
initialised
2129
json
30+
mitigations
2231
numpy
2332
openml
33+
organisation
2434
pre
2535
programme
36+
sacro
2637
scipy
38+
sm
39+
statsmodels
2740
www
2841
xlsx

inst/examples.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Examples
2+
3+
## Interactive Notebook
4+
5+
For comprehensive examples and tutorials, see our interactive R notebook:
6+
7+
[Example Notebook](articles/example-notebook.html)
8+
9+
## Quick Start Examples
10+
11+
### Basic Usage
12+
13+
```r
14+
library("acro")
15+
16+
# Initialize ACRO
17+
acro_init(suppress = TRUE)
18+
19+
# Your analysis code here
20+
# ACRO will automatically check outputs for disclosure risks
21+
```
22+
23+
### Creating Safe Tables
24+
25+
```r
26+
# Example of creating a cross-tabulation with ACRO
27+
result <- acro_crosstab(data$variable1, data$variable2)
28+
29+
# ACRO automatically applies disclosure control
30+
print(result)
31+
```
32+
33+
### Finalizing Your Session
34+
35+
```r
36+
# When you're done with your analysis
37+
acro_finalise()
38+
```
39+
40+
For more detailed examples and use cases, please refer to the [Example Notebook](articles/example-notebook.html).

0 commit comments

Comments
 (0)