Learn R Programming

SSBtools (version 1.7.0)

Statistics Norway's Miscellaneous Tools

Description

Functions used by other packages from Statistics Norway are gathered. General data manipulation functions, algorithms for statistical disclosure control (Langsrud, 2024) and functions for hierarchical computations by sparse model matrices are included (Langsrud, 2023) .

Copy Link

Version

Install

install.packages('SSBtools')

Monthly Downloads

1,057

Version

1.7.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Oyvind Langsrud

Last Published

February 4th, 2025

Functions in SSBtools (1.7.0)

DimList2Hrc

DimList2Hrc/Hrc2DimList
DummyDuplicated

Duplicated columns in dummy matrix
FindCommonCells

Finding commonCells
DummyHierarchy

Converting hierarchy specifications to a (signed) dummy matrix
Extend0fromModelMatrixInput

A specialized version of Extend0()
DummyApply

Apply a function to subsets defined by a dummy matrix
FactorLevCorr

Factor level correlation
Extend0rnd1

varGroups-attribute to Extend0, Example functions
ForceFactorDataFrame

ForceFactorDataFrame
GaussIndependent

Linearly independent rows and columns by Gaussian elimination
ForceCharacterDataFrame

ForceCharacterDataFrame
HierarchiesAndFormula2ModelMatrix

Model matrix representing crossed hierarchies according to a formula
FindHierarchies

Finding hierarchies automatically from data
FormulaSelection.default

Limit matrix or data frame to selected model terms
GaussIterationFunction

An iFunction argument to GaussSuppression
FormulaSums

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

Finding dimList
FindDisclosiveCells

Find directly disclosive cells
HierarchyCompute2

Extended Hierarchical Computations
FindTableGroup

Finding table(s) of hierarchical variable groups
HierarchyCompute

Hierarchical Computations
Hierarchy2Formula

Hierarchy2Formula
HierarchicalWildcardGlobbing

Find variable combinations by advanced wildcard/globbing specifications.
Hierarchies2ModelMatrix

Model matrix representing crossed hierarchies
HierarchyComputeDummy

HierarchyComputeDummy
Matrix2list

Convert matrix to sparse list
GaussSuppression

Secondary suppression by Gaussian elimination
HierarchicalGroups2

Finding hierarchical variable groups
HierarchicalGroups3

Finding hierarchical variable groups
RbindAll

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

Reducing a non-negative regression problem
SSBtoolsData

Function that returns a dataset
HierarchicalGroups

Finding hierarchical variable groups
MatrixPaste

Combining columns of a matrix
HierarchyFix

Change the hierarchy table to follow the standard
MakeHierFormula

Make model formula from data taking into account hierarchical variables
RoundWhole

Round values that are close two whole numbers
RowGroups

Create numbering according to unique rows
NumSingleton

Decoding of singletonMethod
Match

Matching rows in data frames
MatrixToDataFrame

MatrixToDataFrame
Number

Adding leading zeros
SortRows

Sorting rows of a matrix or data frame
Stack

Stack columns from a data frame and include variables.
dummy_aggregate

aggregate_multiple_fun using a dummy matrix
formula_utils

Functions for formula manipulation
hierarchies_as_vars

Hierarchies coded as variables
crossMerge

crossMerge
UniqueSeq

Sequence within unique values
fix_vars_amf

Fix vars parameter to aggregate_multiple_fun
LSfitNonNeg

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

Wrapper to aggregate
matlabColon

Simulate Matlab's ':'
max_contribution

Find Major Contributions to Aggregates and Count Contributors
MakeFreq

Microdata frequency data conversion
combine_formulas

Combine formulas
formula_from_vars

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

Aggregate by base R or data.table
WildcardGlobbingVector

Selection of elements by wildcard/globbing
table_all_integers

Table all integers from 1 to n
tables_by_formulas

Tabular Statistics Based on Formulas
filter_by_variable

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

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

Iterative proportional fitting from matrix input
fix_fun_amf

Fix fun parameter to aggregate_multiple_fun
ModelMatrix

Model matrix from hierarchies and/or a formula
Model_Matrix

Overparameterized model matrix
substitute_formula_vars

Replace variables in formula with sum of other variables
Unstack

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

Row selection by wildcard/globbing
map_hierarchies_to_data

Add variables to dataset based on hierarchies
total_collapse

Collapse variables to single representation
sosialFiktiv

Fictitious datasets returned by SSBtoolsData()
model_aggregate

Hierarchical aggregation via model specification
quantile_weighted

Weighted quantiles
inc_default

Default progress indicator function
unmatrix

Transform data frame with embedded matrices
CrossCodeFrames

Cross codes in data frames
DataDummyHierarchy

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

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

Ensure standardized coding of hierarchies
AddLeadingZeros

Add leading zeros to numbers while preserving other text
CbindIdMatch

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

Checking function inputs
As_TsparseMatrix

Transform to TsparseMatrix/dgTMatrix
CharacterDataFrame

CharacterDataFrame
DataFrameToMatrix

DataFrameToMatrix
Extend0

Add zero frequency rows
DimList2Hierarchy

DimList2Hierarchy