knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)

rtauargus

Run τ-Argus from R

The rtauargus package provides an R interface for τ-Argus.

It allows to:

These different operations can be executed in one go, but also in a modular way. They allow to integrate the tasks performed by τ-Argus in a processing chain written in R.

The package presents other additional functionalities, such as:

It's possible to choose a tabular or microdata approach, but the tabular one is, from now on, encouraged.

Installation

To install a specific version, add to the directory a reference (commit or tag), for example "inseefrlab/rtauargus@v-0.4.1".

Simple example

When loading the package, the console displays some information:

library(rtauargus)

In particular, a plausible location for the τ-Argus software is predefined. This can be changed for the duration of the R session, as follows:

loc_tauargus <- "Y:/Logiciels/TauArgus/TauArgus4.2.2b1/TauArgus.exe"
options(rtauargus.tauargus_exe = loc_tauargus)

With this small adjustment done, the package is ready to be used.

For the following demonstration, a fictitious table will be used:

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)
  )

As primary rules, we use the two following ones:

To get the results for the dominance rule, we need to specify the largest contributor to each cell, corresponding to the MAX variable in the tabular data.

ex1 <- tab_rtauargus(
  act_size,
  dir_name = "tauargus_files",
  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")
)

By default, the function displays in the console the logbook content in which user can read all steps run by τ-Argus. This can be retrieved in the logbook.txt file. With verbose = FALSE, the function can be silenced.

By default, the function returns the original dataset with one variable more, called Status, directly resulting from τ-Argus and describing the status of each cell as follows:

-A: primary secret cell because of frequency rule;
-B: primary secret cell because of dominance rule (1st contributor);
-C: primary secret cell because of frequency rule (more contributors in case when n>1);
-D: secondary secret cell;
-V: valid cells - no need to mask.

ex1

All the files generated by the function are written in the specified directory (dir_name argument). The default format for the protected table is csv but it can be changed. All the τ-Argus files (.tab, .rda, .arb and .txt) are written in the same directory, too. To go further, you can consult the latest version of the τ-Argus manual is downloadable here: https://research.cbs.nl/casc/Software/TauManualV4.1.pdf.

A detailed overview is available via vignette("rtauargus").

Important notes

The functions of rtauargus calling τ-Argus require that this software be accessible from the workstation. The download of τ-Argus is done on the dedicated page of the sdcTools git repository.

The package was developed on the basis of open source versions of τ-Argus (versions 4.2 and above), in particular the version used for this version is τ-Argus 4.2.3. It is not compatible with version 3.5.**



InseeFrLab/rtauargus documentation built on Feb. 25, 2025, 6:32 a.m.