tab_multi_manager | R Documentation |
Manages the secondary secret of a list of tables
tab_multi_manager(
list_tables,
list_explanatory_vars,
dir_name = NULL,
hrc = NULL,
alt_hrc = NULL,
totcode = getOption("rtauargus.totcode"),
alt_totcode = NULL,
value = "value",
freq = "freq",
secret_var = "is_secret_prim",
cost_var = NULL,
suppress = "MOD(1,5,1,0,0)",
ip_start = 10,
ip_end = 0,
num_iter_max = 10,
split_tab = FALSE,
nb_tab_option = "smart",
limit = 14700,
...
)
original list of tables. Secret Results of each iteration is added to each table. For example, the result of first iteration is called 'is_secret_1' in each table. It's a boolean variable, whether the cell has to be masked or not.
tab_rtauargus2
library(rtauargus)
library(dplyr)
data(turnover_act_size)
data(turnover_act_cj)
data(activity_corr_table)
#0-Making hrc file of business sectors ----
hrc_file_activity <- activity_corr_table %>%
write_hrc2(file_name = "hrc/activity")
#1-Prepare data ----
#Indicate whether each cell complies with the primary rules
#Boolean variable created is TRUE if the cell doesn't comply.
#Here the frequency rule is freq in (0;3)
#and the dominance rule is NK(1,85)
list_data_2_tabs <- list(
act_size = turnover_act_size,
act_cj = turnover_act_cj
) %>%
purrr::map(
function(df){
df %>%
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
)
}
)
## Not run:
options(
rtauargus.tauargus_exe =
"Y:/Logiciels/TauArgus/TauArgus4.2.3/TauArgus.exe"
)
res_1 <- tab_multi_manager(
list_tables = list_data_2_tabs,
list_explanatory_vars = list(
act_size = c("ACTIVITY", "SIZE"),
act_cj = c("ACTIVITY", "CJ")
),
hrc = c(ACTIVITY = hrc_file_activity),
dir_name = "tauargus_files",
value = "TOT",
freq = "N_OBS",
secret_var = "is_secret_prim",
totcode = "Total"
)
# With the reduction dimensions feature
data("datatest1")
data("datatest2")
datatest2b <- datatest2 %>%
filter(cj == "Total", treff == "Total", type_distrib == "Total") %>%
select(-cj, -treff, -type_distrib)
str(datatest2b)
res <- tab_multi_manager(
list_tables = list(d1 = datatest1, d2 = datatest2b),
list_explanatory_vars = list(
d1 = names(datatest1)[1:4],
d2 = names(datatest2b)[1:2]
),
dir_name = "tauargus_files",
value = "pizzas_tot_abs",
freq = "nb_obs_rnd",
secret_var = "is_secret_prim",
totcode = "Total",
split_tab = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.