cellInfo() can be used to query information of a single cell
from a sdcProblem object. If the instance has already been protected
protectTable(), the information is retrieved from the final protected
dataset, otherwise from the current state of the instance.
an object of class sdcProblem
input that defines which cells to query; the function expects either (see examples below)
additional parameters for potential future use, currently unused.
data.frame with a row for each of the queried cells; the object
contains the following columns:
id: numeric vector of length 1 specifying the numerical index of the cell
object has not yet been protected
one column for each dimensional variable
freq containing the cell-frequencies
if available, one column for each (possible) numerical value that was tabulated
sdcStatus with the current sdc code
TRUE if the cell is a primary sensitive cell
TRUE if the cell is a secondary suppressed cell
Bernhard Meindl firstname.lastname@example.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# as in makeProblem() with a single primary suppression p <- sdc_testproblem(with_supps = TRUE) sdcProb2df(p) # vector input specs_vec <- c(region = "D", gender = "male") cell_info(p, specs = specs_vec) # data.frame input specs_df <- data.frame( region = c("A", "D", "A"), gender = c("male", "female", "female") ) cell_info(p, specs = specs_df) # protect the table p_safe <- protectTable(p, method = "SIMPLEHEURISTIC") # re-apply cell_info(p_safe, specs = specs_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.