ivo_table_add_mask {ivo.table}R Documentation

Add masking (censoring) to a table

Description

Table masking using cell counts..

Usage

ivo_table_add_mask(df, cell = 5)

Arguments

df

A data frame containing a column called "Freq", e.g. a frequency table created using ftable(exclude=NULL) |> data.frame().

cell

The cell count at which masking should be used. Cell counts between 1 and this number will be masked. The default is 5.

Details

Masking is used to prevent the distribution of tables where individuals could be identified.

Value

A data frame with masked cell counts.

Author(s)

Måns Thulin

See Also

ivo_table_masked for masked tables.

Examples


library(dplyr)
example_data <- data.frame(Year = sample(2020:2023, 50, replace = TRUE),
A = sample(c("Type 1", "Type 2"), 50, replace = TRUE),
B = sample(c("Apples", "Oranges", "Bananas"), 50, replace = TRUE),
C = sample(c("Swedish", "Norwegian", "Chilean"), 50, replace = TRUE))
# With masking limit set at 7:
example_data |> select(Year, A) |>
  ftable(exclude=NULL) |>
  data.frame() |>
  ivo_table_add_mask(cell = 7)


[Package ivo.table version 0.4.1 Index]