View source: R/SuppressKDisclosure.R
| default_targeting | R Documentation |
targeting function for SuppressKDisclosure()Generates a targeting specification for use with
SuppressKDisclosure(). The function is actually used internally by
KDisclosurePrimary().
default_targeting(
crossTable,
x,
identifying = NULL,
sensitive = NULL,
targeting_include = NULL,
targeting_exclude = NULL,
...
)
crossTable |
A |
x |
The model matrix, |
identifying |
Specification of information that an intruder may already
know. The specification is subject to the same requirements as |
sensitive |
Specification of information considered unacceptable to
disclose. It may be given as a character vector of variable names, a named
list with variable names as names and specified codes as values, or a data
frame specifying variable combinations. The wildcard characters |
targeting_include |
A list of two-element lists with components
|
targeting_exclude |
A list specified in the same way as
|
... |
Unused parameters. |
The parameters identifying and sensitive are used to select table cells
(including hidden cells constructed via mc_hierarchies). All such cells are
represented by rows in crossTable, which may be extended due to
mc_hierarchies. Thus, rows in crossTable are selected as identifying or
sensitive.
In addition, sensitive specifies which codes within the selected rows are
regarded as sensitive.
The logic differs slightly for unspecified variables:
For identifying, unspecified variables are set to total codes.
For sensitive, all rows in crossTable matching the specified variables
are selected.
The parameters identifying and sensitive are used to construct the
targeting specification for KDisclosurePrimary(), resulting in the
elements identifying, sensitive, and is_sensitive.
When targeting_include and/or targeting_exclude are specified,
additional elements include_relations and exclude_relations are created.
A named targeting list. See SuppressKDisclosure().
mm <- SSBtools::ModelMatrix(SSBtoolsData("example1"),
formula = ~age * eu + geo, crossTable = TRUE)
crossTable <- mm$crossTable
x <- mm$modelMatrix
default_targeting(crossTable, x) # just NULL
# geo identifying and age sensitive (age sensitive variable)
a2 <- default_targeting(crossTable, x,
identifying = "geo",
sensitive = "age")
a1 <- default_targeting(crossTable, x,
identifying = list(age = "Total", geo = "*"),
sensitive = list(age = "*"))
identical(a1, a2)
a1
# Not ok to disclose 'EU' and 'Portugal'
# But ok to disclose 'Spain' with 'EU' known
# and also ok to disclose 'Spain' in other table cells without 'EU' as marginal
default_targeting(crossTable, x,
sensitive = list(geo = c("Portugal", "EU")))
# As above but now also ok to disclose 'Portugal' from 'EU' known,
# since protection only considers 'age' identifying.
default_targeting(crossTable, x,
identifying = "age",
sensitive = list(geo = c("Portugal", "EU")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.