SmallCountRounding 1.2.5
- New checks for unused arguments in
...
using ellipsis::check_dots_used(), so that misspelled or irrelevant arguments are not silently ignored.- Introduces new arguments in
PLSrounding()
:-
action_unused_dots
controls how unused arguments are handled. -
allowed_unused_dots
specifies argument names to ignore in the unused-argument check.
-
- Users can configure global defaults via options
SmallCountRounding.action_unused_dots
andSmallCountRounding.allowed_unused_dots
. - Note: The default for
action_unused_dots
is"inform"
as a cautious starting point. This may change to"warn"
in a future release.
- Introduces new arguments in
- New duplicate checking method for deciding
preAggregate
inPLSrounding()
.- When
preAggregate = NA
(new default), the function now decides automatically: aggregation is applied unlessfreqVar
is present and the data contain no duplicated rows with respect to the relevant variables. - Previously, duplicate rows were not checked.
- Note that the new default may produce a different
rounded
solution and a different output forinner
. In particular, this ensures that the output of typeinner
does not contain duplicate rows, which is often the desired behavior. However, be aware that it is no longer guaranteed that theinner
output matches the input data. SpecifypreAggregate = FALSE
if this behavior is desired.
- When
SmallCountRounding 1.2.0
CRAN release: 2025-02-05
- New pkgdown website for the package
- This package now has a documentation site at https://statisticsnorway.github.io/ssb-smallcountrounding/.
- SSBtools and Matrix are moved from Depends to Imports
- To follow best practices for R packages
- Some SSBtools functions are reexported instead. See
?SmallCountRounding::reexports
.
- Utilizing updates in the SSBtools package (version 1.7.0).
- The new function
tables_by_formulas()
, which is reexported, is demonstrated in aPLSrounding()
example. - The new function
Extend0fromModelMatrixInput()
is now used in data pre-processing. As a result,hierarchical_extend0
is now a possible parameter, as illustrated in aPLSrounding()
example.
- The new function
SmallCountRounding 1.1.0
CRAN release: 2024-12-09
- Added a check to ensure that at least one of
dimVar
,hierarchies
, orformula
is specified.- This is a breaking change that may affect previous code.
- Previously, if all were unspecified,
dimVar
was automatically generated from the remaining columns. - While this behavior was correctly implemented, it often stemmed from user input errors and could lead to unexpected behavior or crashes.
- This change now requires explicit input, making the function more robust and reducing the risk of user errors.
- Improved support for
tibble
anddata.table
input (parameterdata
).- Input is now explicitly coerced to a data frame using
as.data.frame()
where necessary to ensure consistent behavior. - When
preAggregate
isTRUE
andaggregatePackage
is"data.table"
, the use ofas.data.frame()
is skipped to avoid unnecessary back-and-forth conversion ofdata.table
objects, preserving efficiency. - Applies to
PLSrounding()
and its wrappers.
- Input is now explicitly coerced to a data frame using
- Note new hierarchy possibilities due to the new version of the SSBtools package (version 1.6.0).
-
Output from functions like
get_klass()
in the klassR package orhier_create()
in the sdcHierarchies package can now be used directly as input. Example of usage:a <- get_klass(classification = "24") b <- hier_create(root = "Total", nodes = LETTERS[1:5]) mydata <- data.frame(tree = sample(a$code[nchar(a$code) > 1], 200, replace = TRUE), letter = LETTERS[1:5]) PLSroundingPublish(mydata, roundBase = 5, hierarchies = list(tree = a, letter = b))
New possibilities for working with both formulas and hierarchies are now available through the
map_hierarchies_to_data()
function.Improved functionality for combining formulas with the
Formula2ModelMatrix()
parameteravoidHierarchical = TRUE
, thanks to the newtotal_collapse()
function which can be applied to output.
-
SmallCountRounding 1.0.8
CRAN release: 2024-10-22
-
FormulaSelection()
now works with the output fromPLSrounding()
.- The output dataset corresponding to a restricted part of the input formula can now be easily retrieved.
- See the examples in the documentation.
-
extend0
is new parameter toPLSrounding()
, enabling data to be automatically extended by zero frequency rows.- This is relevant when
zeroCandidates = TRUE
. - The old parameter in
PLSroundingFits()
has been renamed fromextend0
toextend0Fits
. Code that used the old parameter will now behave differently. - Note that
extend0
andextend0Fits
can now be specified in more advanced ways beyond just TRUE/FALSE.
- This is relevant when
- Improvements to the
step
parameter, which can be passed toPLSrounding()
and is documented in the underlying functionRoundViaDummy()
:- A bug that could cause a hang when using
step
has been fixed. - The
step
parameter can now be specified as a vector for greater control. - Additionally, it can be provided as a list to trigger a final re-run iteration.
- The
step
parameter can significantly impact performance on large datasets. For example, usingstep = list(100)
may be a useful approach.
- A bug that could cause a hang when using
- Due to updates in the SSBtools package (version 1.5.4), it is now meaningful to include NA’s in the grouping variables.
- Note the parameter
NAomit
toSSBtools::Formula2ModelMatrix()
:- When
TRUE
, NAs in the grouping variables are omitted in output and not included as a separate category. - This parameter can be input to
PLSrounding()
and its wrappers.
- When
-
aggregateNA
is new parameter toPLSrounding()
:- Whether to include NAs in the grouping variables while preAggregate.
- Needs to be
TRUE
(default) to utilize the aboveNAomit
parameter.
- Note the parameter
- Due to updates in the SSBtools package (version 1.5.4), where data.table is now listed under Suggests, some functionality can be speeded up.
- Set the new parameter
aggregatePackage
to"data.table"
to utilize this possibility.-
aggregatePackage
is parameter toPLSrounding()
and its wrappers. - Also note the related new parameters
aggregateBaseOrder
.
-
- Set the new parameter
SmallCountRounding 1.0.5
CRAN release: 2024-09-05
- Minor updates with no changes in functionality
- Changed package license to MIT, in accordance with the policy at Statistics Norway.
- Some technical changes in documentation to comply with standards.
SmallCountRounding 1.0.3
CRAN release: 2022-11-16
- Workaround for old
R
versions where theisFALSE
function is not defined.
SmallCountRounding 1.0.2
CRAN release: 2022-10-12
- Improved behavior of the
identifyNew
parameter when themaxRound
parameter is used.- New description of the
identifyNew
parameter: WhenTRUE
, new cells may be identified after initial rounding to ensure all rounded publishable cells equal to or less thanmaxRound
to beroundBase
multiples. UseNA
for the a less conservative behavior (old behavior). Then it is ensured that no nonzero rounded publishable cells are smaller thanroundBase
. WhenmaxRound
is default, there is no difference betweenTRUE
andNA
.
- New description of the
SmallCountRounding 1.0.0
CRAN release: 2022-08-26
- New function,
PLSroundingLoop
: PLSrounding on portions of data at a time.- The runs are coordinated by using preliminary differences as input for the next run (parameter
preDifference
)
- The runs are coordinated by using preliminary differences as input for the next run (parameter
- Parameters
zeroCandidates
,forceInner
,preRounded
andplsWeights
can now be specified as functions.- These cannot be supplied as vectors in
PLSroundingLoop
.
- These cannot be supplied as vectors in
- New parameter,
allSmall
.- When TRUE, all small inner cells (
<= maxRound
) are rounded. A simplified alternative to specifyingforceInner
.
- When TRUE, all small inner cells (
- Adaption needed after Matrix ver. 1.4-2 (not a user-visible change)
SmallCountRounding 0.9.0
CRAN release: 2021-09-29
- New function,
PLSroundingFits
, for post-processing to expected frequencies- Expected inner cell frequencies are generated by iterative proportional fitting
-
plsWeights
is new parameter toRoundViaDummy
(andPLSrounding
)- A vector of weights for each cell to be published or a function generating it. For use in the algorithm criterion.
SmallCountRounding 0.8.0
CRAN release: 2021-04-26
- Now, microdata input is allowed. This is due to
- Allowing empty
freqVar
in input. - The new parameter
preAggregate
: WhenTRUE
, the data will be aggregated beforehand within the function by the dimensional variables.
- Allowing empty
- It is possible to avoid handling hierarchical variables when using the formula interface.
- This is a consequence of parameter
avoidHierarchical
toFormula2ModelMatrix
in the SSBtools package.
- This is a consequence of parameter
SmallCountRounding 0.7.0
CRAN release: 2021-03-09
- Now, a random generator seed is used locally within the function without affecting the random value stream in R.
- Handled by
rndSeed
, a new parameter toRoundViaDummy
(andPLSrounding
). - By default,
rndSeed = 123
. This means that repeated runs with equal input will result in equal output. - To get back the old behaviour of the function, set
rndSeed
toNULL
.
- Handled by
- Possible to return a single data frame:
"inner"
or"publish"
.- Handled by
output
, a new parameter toPLSrounding
. - New wrapper functions,
PLSroundingInner
andPLSroundingPublish
.
- Handled by
-
dimVar
is new parameter toRoundViaDummy
andPLSrounding
- The main dimensional variables and additional aggregating variables. This parameter can be useful when hierarchies and formula are unspecified.
SmallCountRounding 0.6.0
CRAN release: 2020-10-15
-
preRounded
is new parameter toRoundViaDummy
(andPLSrounding
)- A mixture of missing values and predetermined values of rounded inner cells
SmallCountRounding 0.5.0
CRAN release: 2020-09-21
- Formula combined with hierarchies is now possible
- This is a consequence of the function
HierarchiesAndFormula2ModelMatrix
in the SSBtools package
- This is a consequence of the function
-
leverageCheck
andeasyCheck
are new parameters toRoundViaDummy
- This provides protection against possible disclosure of small numbers by linear relationships (difference attack)
- The function
Reduce0exact
in the SSBtools package is utilised
-
printInc
is new parameter toPLSrounding
andRoundViaDummy
- Whether to print iteration information to the console
- Possible to specify
removeEmpty=TRUE
to omit empty combinations- Parameter to
Hierarchies2ModelMatrix
andHierarchiesAndFormula2ModelMatrix
in the SSBtools package
- Parameter to
- The parameter
inputInOutput
is also mentioned in the RoundViaDummy documentation- Parameter to same functions as above
- Can be used to specify whether to include codes from input
- A vignette, “Introduction to ‘SmallCountRounding’”, is included