collapse-package

## Fast Statistical Functions

Fast (grouped and weighted) statistical functions for vector, matrix, data frame and grouped tibble (class ‘grouped_df’, dplyr compatible).

A1-fast-statistical-functions

Fast (Grouped, Weighted) Statistical Functions for Matrix-Like Objects

fmean()

Fast (Grouped, Weighted) Mean for Matrix-Like Objects

fmedian()

Fast (Grouped, Weighted) Median Value for Matrix-Like Objects

fmode()

Fast (Grouped, Weighted) Statistical Mode for Matrix-Like Objects

fsum()

Fast (Grouped, Weighted) Sum for Matrix-Like Objects

fprod()

Fast (Grouped, Weighted) Product for Matrix-Like Objects

fvar() fsd()

Fast (Grouped, Weighted) Variance and Standard Deviation for Matrix-Like Objects

fmax() fmin()

Fast (Grouped) Maxima and Minima for Matrix-Like Objects

fnth()

Fast (Grouped, Weighted) N'th Element/Quantile for Matrix-Like Objects

ffirst() flast()

Fast (Grouped) First and Last Value for Matrix-Like Objects

fnobs()

Fast (Grouped) Observation Count for Matrix-Like Objects

fndistinct()

Fast (Grouped) Distinct Value Count for Matrix-Like Objects

## Fast Grouping and Ordering

Fast (ordered) groupings from vectors, data.frames, lists. Fast ordering, unique values / rows, factor generation and interactions, run-length type grouping and grouping of time-sequences.

A2-fast-grouping-ordering

Fast Grouping and Ordering

GRP() is_GRP() GRPnames() as_factor_GRP() fgroup_by() gby() fgroup_vars() fungroup() print(<GRP>) plot(<GRP>)

Fast Grouping / collapse Grouping Objects

radixorder() radixorderv()

funique()

Fast Unique Elements / Rows

qF() qG() is_qG() as_factor_qG() finteraction()

Fast Factor Generation, Interactions and Vector Grouping

fdroplevels()

Fast Removal of Unused Factor Levels

groupid()

Generate Run-Length Type Group-Id

seqid()

Generate Group-Id from Integer Sequences

## Fast Data Manipulation

Fast and flexible select, replace, add, subset, transform, sort / reorder and rename data / data frame columns.

A3-fast-data-manipulation

Fast Data Manipulation

fselect() fselect<-() slt() slt<-() get_vars() gv() gvr() get_vars<-() gv<-() gvr<-() add_vars() add_vars<-() av() av<-() num_vars() num_vars<-() nv() nv<-() cat_vars() cat_vars<-() char_vars() char_vars<-() fact_vars() fact_vars<-() logi_vars() logi_vars<-() date_vars() date_vars<-()

Fast Select, Replace or Add Data Frame Columns

fsubset() sbt() ss()

Fast Subsetting Matrix-Like Objects

fsummarise() smr()

Fast Summarise

ftransform() ftransformv() tfm() tfmv() settransform() settransformv() settfm() settfmv() ftransform<-() tfm<-() fcompute() fcomputev()

Fast Transform and Compute Columns on a Data Frame

roworder() roworderv()

Fast Reordering of Data Frame Rows

colorder() colorderv()

Fast Reordering of Data Frame Columns

frename() setrename()

Fast Renaming Objects

## Quick Data Conversion

Quick conversions between data.frame’s, data.table’s, tibbles, matrices, arrays, lists, vectors and factors - fast and flexible, without method dispatch or extensive checks.

qDF() qDT() qTBL() qM() mctl() mrtl() as_numeric_factor() as_character_factor()

Quick Data Conversion

qF() qG() is_qG() as_factor_qG() finteraction()

Fast Factor Generation, Interactions and Vector Grouping

Fast and easy multi-data-type, multi-function, weighted, parallelized and fully customized data aggregation.

collap() collapv() collapg()

## Data Transformations

Fast row / column arithmetic, efficient row / column apply to data objects and Split-Apply-Combine computing. Fast (grouped, weighted) replacing and sweeping out of statistics, scaling / standardizing, (quasi-)centering, higher-dimensional centering, linear prediction / partialling-out.

A6-data-transformations

Data Transformations

%rr% %r+% %r-% %r*% %r/% %cr% %c+% %c-% %c*% %c/%

Fast Row/Column Arithmetic for Matrix-Like Objects

dapply()

Data Apply

BY()

Split-Apply-Combine Computing

TRA()

Transform Data by (Grouped) Replacing or Sweeping out Statistics

fscale() STD()

Fast (Grouped, Weighted) Scaling and Centering of Matrix-like Objects

fbetween() fwithin() B() W()

Fast Between (Averaging) and (Quasi-)Within (Centering) Transformations

fhdbetween() fhdwithin() HDB() HDW()

Higher-Dimensional Centering and Linear Prediction

## Linear Models

Fast (weighted) linear model fitting. A fast F-test for high-dimensional linear models.

flm()

Fast (Weighted) Linear Model Fitting

fFtest()

Fast (Weighted) F-test for Linear Models (with Factors)

## Time Series and Panel Series

Fast (sequences of) lags / leads, and (lagged / leaded, iterated, quasi-, log-) differences and (compounded) growth rates on (unordered, irregular) time series and panel data. Auto-, partial- and cross-correlation functions for panel data. Panel data to (ts-)array conversion.

A7-time-series-panel-series

Time Series and Panel Series

flag() L() F()

Fast Lags and Leads for Time Series and Panel Data

fdiff() D() Dlog()

Fast (Quasi-, Log-) Differences for Time Series and Panel Data

fgrowth() G()

Fast Growth Rates for Time Series and Panel Data

fcumsum()

Fast (Grouped, Ordered) Cumulative Sum for Matrix-Like Objects

psacf() pspacf() psccf()

Auto- and Cross- Covariance and Correlation Function Estimation for Panel Series

psmat() plot(<psmat>)

Matrix / Array from Panel Series

## List Processing

Recursive list search / identification, extraction / subsetting, splitting, data-apply, and generalized recursive row-binding / unlisting in 2D.

A8-list-processing

List Processing

is_unlistable()

Unlistable Lists

ldepth()

Determine the Depth / Level of Nesting of a List

atomic_elem() atomic_elem<-() list_elem() list_elem<-() reg_elem() irreg_elem() get_elem() has_elem()

Find and Extract / Subset List Elements

rsplit()

Recursive Splitting

t_list()

Efficient List Transpose

rapply2d()

Recursively Apply a Function to a List of Data Objects

unlist2d()

Recursive Row-Binding / Unlisting in 2D - to Data Frame

## Summary Statistics

Fast (grouped, weighted, panel-decomposed) summary statistics for cross-sectional and complex multilevel / panel data.

A9-summary-statistics

Summary Statistics

qsu() print(<qsu>)

Fast (Grouped, Weighted) Summary Statistics for Cross-Sectional and Panel Data

descr() print(<descr>) as.data.frame(<descr>)

Detailed Statistical Description of Data Frame

pwcor() pwcov() pwnobs() print(<pwcor>) print(<pwcov>)

(Pairwise, Weighted) Correlations, Covariances and Observation Counts

varying()

Fast Check of Variation in Data

## Recode and Replace Values

Efficiently recode and replace values in matrix-like objects.

recode_num() recode_char() replace_NA() replace_Inf() replace_outliers()

Recode and Replace Values in Matrix-Like Objects

pad()

Pad Matrix-Like Objects with a Value

## Small (Helper) Functions

Convenience functions that help to deal with variable names, labels, attributes, missing values, matching and object checking etc.. Some functions are performance improved replacements for base R functions.

.c() vlabels() vlabels<-() setLabels() vclasses() vtypes() namlab() add_stub() rm_stub() %!in% ckmatch() fnlevels() fnrow() fncol() fdim() alloc() allNA() missing_cases() na_rm() na_omit() na_insert() cinv() all_identical() all_obj_equal() seq_row() seq_col() setRownames() setColnames() setDimnames() unattrib() setAttrib() copyAttrib() copyMostAttrib() is_categorical() is_date()

Small (Helper) Functions

## Data

Groningen Growth and Development Centre 10-Sector Database and World Bank World Development dataset.

GGDC10S

Groningen Growth and Development Centre 10-Sector Database

wlddev

World Development Dataset

## Package Options

Global options affecting package operation.

collapse-options

collapse Package Options