View source: R/tab_rtauargus.R
tab_rtauargus | R Documentation |
The function prepares all the files needed by Tau-Argus and launches the software with the good settings and gets back the result.
tab_rtauargus(
tabular,
explanatory_vars,
files_name = NULL,
dir_name = NULL,
totcode = getOption("rtauargus.totcode"),
hrc = NULL,
secret_var = NULL,
secret_no_pl = NULL,
cost_var = NULL,
value = "value",
freq = "freq",
ip = 10,
maxscore = NULL,
suppress = "MOD(1,5,1,0,0)",
safety_rules = paste0("MAN(", ip, ")"),
show_batch_console = FALSE,
output_type = 4,
output_options = "",
unif_labels = TRUE,
split_tab = FALSE,
nb_tab_option = "smart",
limit = 14700,
...
)
If output_type equals to 4 and split_tab = FALSE, then the original tabular is returned with a new column called Status, indicating the status of the cell coming from Tau-Argus : "A" for a primary secret due to frequency rule, "B" for a primary secret due to dominance rule, "D" for secondary secret and "V" for no secret cell.
If split_tab = TRUE,
then the original tabular is returned with some new columns which are boolean
variables indicating the status of a cell at each iteration of the protection
process as we get with tab_multi_manager()
function. TRUE
denotes a cell that have to be suppressed. The last column is then the
final status of the suppression process of the original table.
If split_tab = FALSE
and output_type
doesn't equal to 4
,
then the raw result from tau-argus is returned.
The boolean argument unif_labels
is useful to
prevent some common errors in using Tau-Argus. Indeed, Tau-Argus needs that,
within a same level of a hierarchy, the labels have the same number of
characters. When the argument is set to TRUE, tab_rtauargus
standardizes the explanatory variables to prevent this issue.
Hierarchical explanatory variables (explanatory variables associated to
a hrc file) are then modified in the tabular data and an another hrc file is
created to be relevant with the tabular. In the output, these modifications
are removed.
## Not run:
library(dplyr)
data(turnover_act_size)
# Prepare data with primary secret ----
turnover_act_size <- turnover_act_size %>%
mutate(
is_secret_freq = N_OBS > 0 & N_OBS < 3,
is_secret_dom = ifelse(MAX == 0, FALSE, MAX/TOT>0.85),
is_secret_prim = is_secret_freq | is_secret_dom
)
# Make hrc file of business sectors ----
data(activity_corr_table)
hrc_file_activity <- activity_corr_table %>%
write_hrc2(file_name = "hrc/activity")
# Compute the secondary secret ----
options(
rtauargus.tauargus_exe =
"Y:/Logiciels/TauArgus/TauArgus4.2.3/TauArgus.exe"
)
res <- tab_rtauargus(
tabular = turnover_act_size,
files_name = "turn_act_size",
dir_name = "tauargus_files",
explanatory_vars = c("ACTIVITY", "SIZE"),
hrc = c(ACTIVITY = hrc_file_activity),
totcode = c(ACTIVITY = "Total", SIZE = "Total"),
secret_var = "is_secret_prim",
value = "TOT",
freq = "N_OBS",
verbose = FALSE
)
# Reduce dims feature
data(datatest1)
res_dim4 <- tab_rtauargus(
tabular = datatest1,
dir_name = "tauargus_files",
explanatory_vars = c("A10", "treff","type_distrib","cj"),
totcode = rep("Total", 4),
secret_var = "is_secret_prim",
value = "pizzas_tot_abs",
freq = "nb_obs_rnd",
split_tab = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.