Skip to content

About

τ-Argus from R

Resources

Stars

2 stars

Watchers

1 watching

Forks

 
 

Repository files navigation

rtauargus.native

An R interface for Tau-Argus, statistical disclosure control for tables and microdata.

This is a fork of INSEE’s rtauargus. Upstream launches the legacy TauArgus.exe executable. This fork executes the same .arb batches in process, through the native HiGHS-backed tauargus-engine. Function names, arguments and return values follow upstream; see docs/compatibility.md for the intentional differences. The package is self-contained: the native engine and HiGHS are bundled in it and build at install time, so there is one package to install and no separate Tau-Argus installation required. After installing the package, load library(rtauargus.native) and run the R functions. There is no Tau-Argus executable path or external solver to configure.

Documentation for this version

This README covers installation, native execution, a complete table example and direct .arb batches for rtauargus.native. The compatibility guide records the differences from INSEE’s package and the legacy Tau-Argus engine, including output formats that are not implemented and possible differences in secondary suppression patterns.

The high-level R interface builds on INSEE’s rtauargus. Use its full function reference and guides for table and microdata preparation, hierarchies, safety rules and linked tables. The original authors’ documentation remains the reference for those inherited functions; this README explains how to use them with the bundled native engine. Installed help is also available, for example with ?tab_rtauargus and ?run_arb.

When following an upstream example:

  • Load rtauargus.native instead of rtauargus.
  • Skip the separate Tau-Argus installation and options(rtauargus.tauargus_exe = ...) configuration.
  • Use the solver included in this package. No CPLEX or XPRESS installation or license is needed.
  • Check the compatibility guide for execution and output differences.

The tauargus_exe, logbook, verbose and ... arguments of run_arb() remain accepted for backward compatibility and are ignored. Data paths, safety rules and other task-specific inputs still need to be supplied as in the original R interface.

Installation

Install the package from GitHub Releases.

Each GitHub Release (tags r-v*) contains one binary per platform, a source tarball and a release-manifest.json with the SHA-256 hash of every asset. The binaries are built for R 4.5.3 (the r4.5.3 in the file name) and install without a compiler. The source tarball works with other R versions and needs CMake >= 3.16 and a C++17 compiler. The CRAN dependencies below install from CRAN as usual (on Linux they compile from source, and igraph takes a few minutes):

install.packages(c("purrr", "dplyr", "tidyr", "data.table", "gdata",
                   "stringr", "rlang", "zoo", "sdcHierarchies",
                   "igraph", "lifecycle"))

The URLs below select release r-v0.6.0, whose R packages carry version 1.3.7. For another release, take the asset names from its release page. The release tag and the R package version are separate identifiers.

Windows:

install.packages(
  "https://github.com/trygu/rtauargus.native/releases/download/r-v0.6.0/rtauargus.native_1.3.7.zip",
  repos = NULL, type = "binary")
library(rtauargus.native)

The Windows binary follows the CRAN file name form rtauargus.native_<version>.zip: R’s zip installer derives the package directory from the file name, so a platform-suffixed name would install the package under the wrong directory.

macOS (Apple silicon; the release targets arm64):

install.packages(
  "https://github.com/trygu/rtauargus.native/releases/download/r-v0.6.0/rtauargus.native_1.3.7_r4.5.3_macos-arm64.tar.gz",
  repos = NULL, type = "binary")
library(rtauargus.native)

Linux:

install.packages(
  "https://github.com/trygu/rtauargus.native/releases/download/r-v0.6.0/rtauargus.native_1.3.7_r4.5.3_linux-x86_64.tar.gz",
  repos = NULL)
library(rtauargus.native)

type = "binary" is only supported on Windows and macOS. On Linux the prebuilt tarball installs as a source package, so the argument is omitted.

Source installation for supported R versions (builds the bundled engine at install time):

install.packages(
  "https://github.com/trygu/rtauargus.native/releases/download/r-v0.6.0/rtauargus.native_1.3.7.tar.gz",
  repos = NULL)
library(rtauargus.native)

Package versions and upstream provenance

The development package records the imported INSEE revision in upstream.json. Its package version combines the version from that revision’s DESCRIPTION with the native engine version, separated by a hyphen. The INSEE component is currently 1.3.6. It changes only after new upstream code has been imported and reviewed.

Release r-v0.6.0 predates this scheme and contains R packages numbered 1.3.7. R considers a composite starting with 1.3.6 older than 1.3.7. If you installed one of those files, explicitly install the new release from its source or binary file; automatic version-based updates will not select it. You can inspect your installed package with packageVersion("rtauargus.native").

License

The assembled native package uses EUPL-1.2. INSEE’s R frontend and HiGHS retain their original MIT terms. Current source builds install a COPYRIGHTS overview and the original component notices under LICENSES.

Quick start

Once installed, the same R code runs on Windows, macOS and Linux. The example below protects a small table with two primary safety rules (minimum frequency and 1-85 dominance) and the default secondary (modular) suppression:

library(rtauargus.native)

act_size <- data.frame(
  ACTIVITY = c("01","01","01","02","02","02","06","06","06","Total","Total","Total"),
  SIZE = c("tr1","tr2","Total","tr1","tr2","Total","tr1","tr2","Total","tr1","tr2","Total"),
  VAL = c(100,50,150,30,20,50,60,40,100,190,110,300),
  N_OBS = c(10,5,15,2,5,7,8,6,14,20,16,36),
  MAX = c(20,15,20,20,10,20,16,38,38,20,38,38)
)

ex1 <- tab_rtauargus(
  act_size,
  dir_name = file.path(tempdir(), "tauargus_ex1"),
  files_name = "ex1",
  explanatory_vars = c("ACTIVITY", "SIZE"),
  safety_rules = "FREQ(3,10)|NK(1,85)",
  value = "VAL",
  freq = "N_OBS",
  maxscore = "MAX",
  totcode = c(ACTIVITY = "Total", SIZE = "Total"),
  verbose = FALSE
)
ex1

tab_rtauargus() writes the table input set (.tab values, .rda metadata, .arb batch) into dir_name, runs the batch, writes the published CSV and returns the input table with a Status column:

  • A: primary secret, frequency rule
  • B: primary secret, dominance rule (first contributor)
  • C: primary secret, frequency rule with more than one contributor
  • D: secondary secret
  • V: valid, no masking needed

Running your own .arb batch

The quick start call already wrote the table input set (ex1.tab for the values, ex1.rda for the metadata) into dir_name. You can drive that same input set from a hand-written batch with run_arb(); the legacy batch grammar is a drop-in. This batch applies the same primary and secondary rules and exports a pivot CSV with a status column (AS+):

dir <- file.path(tempdir(), "tauargus_ex1")
arb <- file.path(dir, "ex1_hand.arb")
writeLines(c(
  sprintf('<OPENTABLEDATA> "%s"', file.path(dir, "ex1.tab")),
  sprintf('<OPENMETADATA> "%s"', file.path(dir, "ex1.rda")),
  '<SPECIFYTABLE> "ACTIVITY""SIZE"|"VAL"||',
  "<SAFETYRULE> FREQ(3,10)|NK(1,85)",
  "<READTABLE> 1",
  "<SUPPRESS> MOD(1,5,1,0,0)",
  sprintf('<WRITETABLE> (1,2,AS+,"%s")', file.path(dir, "ex1_hand.csv"))
), arb)

run_arb(arb)
read.csv(file.path(dir, "ex1_hand.csv"))

The lines follow the legacy grammar: OPENTABLEDATA / OPENMETADATA open the input set, SPECIFYTABLE declares the explanatory and response variables, SAFETYRULE sets the primary rules, READTABLE loads the table and SUPPRESS runs the secondary suppression. The four WRITETABLE fields are the table number, the output format (1 plain CSV, 2 pivot CSV, 3 code value, 4 SBS, 5 intermediate), option letters (AS+ adds the Status column) and the output file.

run_arb() runs silently and returns NULL by default; the results land in the output file. Pass import = TRUE to get a list of data frames back into R.

To protect microdata instead of a pre-aggregated table, use micro_rtauargus() (see the vignette rtauargus_micro).

Checking the installed engine

tauargus_engine_meta()        # engine commit + HiGHS version of this build
tauargus_version(new_tauargus())

Report the tauargus_engine_meta() output when filing a problem. The native audit (CSP intervalle check) is exposed as audit_jj(jjfile); the front-end uses it through the engine object’s audit(tab) method and the with_audit table export.

Ownership and development

  • This repo owns the R front-end: package, tests, releases.
  • The native engine and the R binding live in tauargus-engine and are pinned here as a git submodule (tauargus-engine/; the gitlink is the pin). Bump the submodule to the engine commit you want, then push.
  • The release pipeline (.github/workflows/release.yml) stages the native layer into this package from the pinned source. Every run builds the package on Linux, macOS and Windows, then installs each built artifact in a fresh environment without a product checkout, runs the full test suite and the shared ex1 .arb job against it, and checks the installed engine metadata. On r-v* tags it additionally writes per-artifact SHA-256 manifests, verifies them (hashes, platform coverage, lockstep with the pinned engine) and publishes only the verified assets to the GitHub Release.

About

τ-Argus from R

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages