AdditionalSuppression function

GaussSuppression from data and suppressed data

GaussSuppression from data and suppressed data

Extended version of GaussSuppressionFromData that takes into account suppression pattern in suppressed data sent as input

AdditionalSuppression( data, ..., fun = GaussSuppressionFromData, primary = GetDefault(fun, "primary"), suppressedData = NULL, makePrimary = TRUE, makeForced = TRUE, forceNotPrimary = TRUE )

Arguments

  • data: Input data as a data frame
  • ...: Further parameters to GaussSuppressionFromData
  • fun: A function: GaussSuppressionFromData or one of its wrappers such as SuppressSmallCounts and SuppressDominantCells.
  • primary: As input to GaussSuppressionFromData before possible extension caused by suppressedData. Supply NULL if all primary suppressions are retrieved form suppressedData.
  • suppressedData: A data frame or a list of data frames as output from GaussSuppressionFromData.
  • makePrimary: When TRUE, suppression in suppressedData is preserved.
  • makeForced: When TRUE, non-suppression in suppressedData is preserved. An exception is possible primary suppression which has priority over forced. Use forceNotPrimary to avoid this exception.
  • forceNotPrimary: When TRUE, non-suppression in suppressedData is forced to be not primary suppressed.

Returns

Aggregated data with suppression information

Details

This function is an easy alternative to using PrimaryFromSuppressedData and the relating functions manually. See the examples of PrimaryFromSuppressedData. By default, the suppression pattern in suppressedData is preserved. The behavior can be tuned by the parameters.

Note that the variables used in suppressedData in addition to "suppressed" are those with matching names in crossTable. Others are ignored. See examples (d3, d4, d5). NOW A FIX IS INCLUDED by attribute totCode. EXAMPLES NOT YET CHANGED.

Examples

z1 <- SSBtoolsData("z1") z2 <- SSBtoolsData("z2") z3 <- SSBtoolsData("z3") # Ordinary suppressions a <- GaussSuppressionFromData(z1, 1:2, 3, maxN = 5) b <- GaussSuppressionFromData(z2, 1:4, 5, maxN = 1) # As b and also suppression pattern in a preserved b1 <- AdditionalSuppression(z2, 1:4, 5, maxN = 1, suppressedData = a) # Rows with differences cbind(b, b1)[b1$suppressed != b$suppressed, ] # All primary from a b2 <- AdditionalSuppression(z2, 1:4, 5, suppressedData = a, primary = NULL, singleton = NULL) # Rows with suppression b2[b2$suppressed, ] # All primary from b2 d1 <- AdditionalSuppression(data = z3, 1:6, 7, suppressedData = b2, primary = NULL, singleton = NULL) # No suppression since no common codes d1[d1$suppressed, ] # Use another coding of fylke z3$fylke_ <- z3$fylke - 4 d2 <- AdditionalSuppression(data = z3, c(1, 3:6, 8), 7, suppressedData = b2, primary = NULL, singleton = NULL) # Two primary found in b2 -> several secondary d2[d2$suppressed,] # Examples demonstrating limitations of AdditionalSuppression # Variable mnd in suppressedData is not used # No suppression since unsuppressed rows used by makeForced and forceNotPrimary d3 <- AdditionalSuppression(data = z3, c(1, 3:4, 8), 7, suppressedData = d2, primary = NULL, singleton = NULL) d3[d3$suppressed, ] # Now suppression, but not too much d4 <- AdditionalSuppression(data = z3, c(1, 3:4, 8), 7, suppressedData = d2, forceNotPrimary = FALSE, primary = NULL, singleton = NULL) d4[d4$suppressed, ] # The correct way is to limit the input d5 <- AdditionalSuppression(data = z3, c(1, 3:4, 8), 7, suppressedData = d2[d2$mnd == "Total", ], primary = NULL, singleton = NULL) d5[d5$suppressed, ]