Learn R Programming

SSBtools (version 1.8.1)

Algorithms and Tools for Tabular Statistics and Hierarchical Computations

Description

Includes general data manipulation functions, algorithms for statistical disclosure control (Langsrud, 2024) and functions for hierarchical computations by sparse model matrices (Langsrud, 2023) .

Copy Link

Version

Install

install.packages('SSBtools')

Monthly Downloads

766

Version

1.8.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Oyvind Langsrud

Last Published

August 18th, 2025

Functions in SSBtools (1.8.1)

Extend0

Add zero frequency rows
DimList2Hrc

DimList2Hrc/Hrc2DimList
FindDimLists

Finding dimList
FindDisclosiveCells

Find directly disclosive cells
FormulaSums

Sums (aggregates) and/or sparse model matrix with possible cross table
ForceFactorDataFrame

ForceFactorDataFrame
DummyApply

Apply a function to subsets defined by a dummy matrix
FactorLevCorr

Factor level correlation
ForceCharacterDataFrame

ForceCharacterDataFrame
GaussIterationFunction

An iFunction argument to GaussSuppression
FormulaSelection.default

Limit matrix or data frame to selected model terms
GaussIndependent

Linearly independent rows and columns by Gaussian elimination
FindTableGroup

Finding table(s) of hierarchical variable groups
FindHierarchies

Finding hierarchies automatically from data
HierarchicalGroups

Finding hierarchical variable groups
HierarchicalWildcardGlobbing

Find variable combinations by advanced wildcard/globbing specifications.
HierarchiesAndFormula2ModelMatrix

Model matrix representing crossed hierarchies according to a formula
HierarchicalGroups3

Finding hierarchical variable groups
Hierarchies2ModelMatrix

Model matrix representing crossed hierarchies
HierarchyCompute

Hierarchical Computations
GaussSuppression

Secondary suppression by Gaussian elimination
HierarchyCompute2

Extended Hierarchical Computations
Hierarchy2Formula

Hierarchy2Formula
HierarchicalGroups2

Finding hierarchical variable groups
Match

Matching rows in data frames
MakeHierFormula

Make model formula from data taking into account hierarchical variables
Matrix2list

Convert matrix to sparse list
Mipf

Iterative proportional fitting from matrix input
HierarchyFix

Change the hierarchy table to follow the standard
LSfitNonNeg

Non-negative regression fits with a sparse overparameterized model matrix
MakeFreq

Microdata frequency data conversion
MatrixPaste

Combining columns of a matrix
MatrixToDataFrame

MatrixToDataFrame
HierarchyComputeDummy

HierarchyComputeDummy
Number

Adding leading zeros
RbindAll

Combining several data frames when the columns don't match
Reduce0exact

Reducing a non-negative regression problem
RoundWhole

Round values that are close two whole numbers
SortRows

Sorting rows of a matrix or data frame
ModelMatrix

Model matrix from hierarchies and/or a formula
NumSingleton

Decoding of singletonMethod
RowGroups

Create numbering according to unique rows
Model_Matrix

Overparameterized model matrix
SSBtoolsData

Function that returns a dataset
aggregate_by_pkg

Aggregate by base R or data.table
any_duplicated_rows

Fast alternative to anyDuplicated()
Stack

Stack columns from a data frame and include variables.
UniqueSeq

Sequence within unique values
aggregate_multiple_fun

Wrapper to aggregate
WildcardGlobbing

Row selection by wildcard/globbing
Unstack

Unstack a column from a data frame and include additional variables.
WildcardGlobbingVector

Selection of elements by wildcard/globbing
crossMerge

crossMerge
combine_formulas

Combine formulas
inc_default

Default progress indicator function
map_hierarchies_to_data

Add variables to dataset based on hierarchies
filter_by_variable

Filter a List of Items or Retrieve Names by a Variable
dummy_aggregate

aggregate_multiple_fun using a dummy matrix
formula_utils

Functions for formula manipulation
formula_term_labels

Retrieve term labels from a formula
formula_from_vars

Generate model formula by specifying which variables have totals or not.
fix_vars_amf

Fix vars parameter to aggregate_multiple_fun
hierarchies_as_vars

Hierarchies coded as variables
fix_fun_amf

Fix fun parameter to aggregate_multiple_fun
output_term_labels

Extract vector of term labels from a data.frame
max_contribution

Find Major Contributions to Aggregates and Count Contributors
matlabColon

Simulate Matlab's ':'
tables_by_formulas

Tabular Statistics Based on Formulas
table_all_integers

Table all integers from 1 to n
quantile_weighted

Weighted quantiles
total_collapse

Collapse variables to single representation
sosialFiktiv

Fictitious datasets returned by SSBtoolsData()
model_aggregate

Hierarchical aggregation via model specification
substitute_formula_vars

Replace variables in formula with sum of other variables
vars_to_hierarchies

Transform hierarchies coded as Variables to "to-from" format
unmatrix

Transform data frame with embedded matrices
CheckInput

Checking function inputs
AutoSplit

Creating variables by splitting the elements of a character vector without needing a split string
AutoHierarchies

Ensure standardized coding of hierarchies
CharacterDataFrame

CharacterDataFrame
CbindIdMatch

Combine several data frames by using id variables to match rows
As_TsparseMatrix

Transform to TsparseMatrix/dgTMatrix
AddLeadingZeros

Add leading zeros to numbers while preserving other text
DataDummyHierarchy

Create a (signed) dummy matrix for hierarcical mapping of codes in data
CrossCodeFrames

Cross codes in data frames
DataFrameToMatrix

DataFrameToMatrix
FindCommonCells

Finding commonCells
DummyHierarchy

Converting hierarchy specifications to a (signed) dummy matrix
Extend0rnd1

varGroups-attribute to Extend0, Example functions
Extend0fromModelMatrixInput

A specialized version of Extend0()
DummyDuplicated

Duplicated columns in dummy matrix
DimList2Hierarchy

DimList2Hierarchy