Learn R Programming

⚠️There's a newer version (1.8.0) of this package.Take me there.

SSBtools (version 1.6.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

990

Version

1.6.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Oyvind Langsrud

Last Published

December 4th, 2024

Functions in SSBtools (1.6.0)

DummyDuplicated

Duplicated columns in dummy matrix
DimList2Hierarchy

DimList2Hierarchy
FactorLevCorr

Factor level correlation
FindDisclosiveCells

Find directly disclosive cells
GaussIndependent

Linearly independent rows and columns by Gaussian elimination
FormulaSums

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

ForceCharacterDataFrame
FindTableGroup

Finding table(s) of hierarchical variable groups
ForceFactorDataFrame

ForceFactorDataFrame
FormulaSelection.default

Limit matrix or data frame to selected model terms
FindHierarchies

Finding hierarchies automatically from data
Hierarchy2Formula

Hierarchy2Formula
HierarchiesAndFormula2ModelMatrix

Model matrix representing crossed hierarchies according to a formula
HierarchicalGroups3

Finding hierarchical variable groups
HierarchyCompute

Hierarchical Computations
HierarchicalWildcardGlobbing

Find variable combinations by advanced wildcard/globbing specifications.
Hierarchies2ModelMatrix

Model matrix representing crossed hierarchies
HierarchyComputeDummy

HierarchyComputeDummy
HierarchyCompute2

Extended Hierarchical Computations
GaussIterationFunction

An iFunction argument to GaussSuppression
GaussSuppression

Secondary suppression by Gaussian elimination
Match

Matching rows in data frames
HierarchicalGroups2

Finding hierarchical variable groups
HierarchicalGroups

Finding hierarchical variable groups
LSfitNonNeg

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

Convert matrix to sparse list
ModelMatrix

Model matrix from hierarchies and/or a formula
Mipf

Iterative proportional fitting from matrix input
HierarchyFix

Change the hierarchy table to follow the standard
MakeHierFormula

Make model formula from data taking into account hierarchical variables
MatrixPaste

Combining columns of a matrix
MakeFreq

Microdata frequency data conversion
MatrixToDataFrame

MatrixToDataFrame
Number

Adding leading zeros
RbindAll

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

Create numbering according to unique rows
SSBtoolsData

Function that returns a dataset
Reduce0exact

Reducing a non-negative regression problem
RoundWhole

Round values that are close two whole numbers
combine_formulas

Combine formulas
WildcardGlobbing

Row selection by wildcard/globbing
NumSingleton

Decoding of singletonMethod
Model_Matrix

Overparameterized model matrix
fix_fun_amf

Fix fun parameter to aggregate_multiple_fun
dummy_aggregate

aggregate_multiple_fun using a dummy matrix
UniqueSeq

Sequence within unique values
Unstack

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

Selection of elements by wildcard/globbing
model_aggregate

Hierarchical aggregation via model specification
quantile_weighted

Weighted quantiles
map_hierarchies_to_data

Add variables to dataset based on hierarchies
crossMerge

crossMerge
hierarchies_as_vars

Hierarchies coded as variables
inc_default

Default progress indicator function
formula_utils

Functions for formula manipulation
formula_from_vars

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

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

Transform data frame with embedded matrices
fix_vars_amf

Fix vars parameter to aggregate_multiple_fun
SortRows

Sorting rows of a matrix or data frame
aggregate_by_pkg

Aggregate by base R or data.table
matlabColon

Simulate Matlab's ':'
max_contribution

Find Major Contributions to Aggregates and Count Contributors
aggregate_multiple_fun

Wrapper to aggregate
substitute_formula_vars

Replace variables in formula with sum of other variables
Stack

Stack columns from a data frame and include variables.
sosialFiktiv

Fictitious datasets returned by SSBtoolsData()
total_collapse

Collapse variables to single representation
table_all_integers

Table all integers from 1 to n
DataFrameToMatrix

DataFrameToMatrix
AutoHierarchies

Ensure standardized coding of hierarchies
CheckInput

Checking function inputs
As_TsparseMatrix

Transform to TsparseMatrix/dgTMatrix
CbindIdMatch

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

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

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

Add leading zeros to numbers while preserving other text
DummyHierarchy

Converting hierarchy specifications to a (signed) dummy matrix
DummyApply

Apply a function to subsets defined by a dummy matrix
Extend0

Add zero frequency rows
DimList2Hrc

DimList2Hrc/Hrc2DimList
Extend0rnd1

varGroups-attribute to Extend0, Example functions
FindCommonCells

Finding commonCells
FindDimLists

Finding dimList
CharacterDataFrame

CharacterDataFrame
CrossCodeFrames

Cross codes in data frames