collapse-package

## Fast Statistical Functions

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

fast-statistical-functions

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

fmean()

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

fnth() fmedian()

Fast (Grouped, Weighted) N'th Element/Quantile 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

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 and counts, factor generation and interactions, run-length type grouping and grouping of time-sequences.

fast-grouping-ordering

Fast Grouping and Ordering

GRP() is_GRP() length(<GRP>) GRPN() GRPid() GRPnames() as_factor_GRP() gsplit() greorder() fgroup_by() fgroup_vars() fungroup() print(<GRP>) plot(<GRP>)

Fast Grouping / collapse Grouping Objects

radixorder() radixorderv()

group()

Fast Hash-Based Grouping

funique() fnunique()fduplicated()any_duplicated()

Fast Unique Elements / Rows

fcount() fcountv()

Efficiently Count Observations by Group

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

timeid()

Generate Integer-Id From Time/Date Sequences

## Fast Data Manipulation

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

fast-data-manipulation

Fast Data Manipulation

fselect() fselect<-() get_vars() get_vars<-() add_vars() add_vars<-() num_vars() num_vars<-() 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() ss()

Fast Subsetting Matrix-Like Objects

fsummarise() fsummarize()

Fast Summarise

ftransform() ftransformv() settransform() settransformv() ftransform<-() fcompute() fcomputev() fmutate()

Fast Transform and Compute Columns on a Data Frame

across()

Apply Functions Across Multiple Columns

roworder() roworderv()

Fast Reordering of Data Frame Rows

colorder() colorderv()

Fast Reordering of Data Frame Columns

frename() setrename() relabel() setrelabel()

Fast Renaming and Relabelling 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 and parallelized 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.

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() setTRA()

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 and flexible indexed time series and panel data classes. Fast (sequences of) lags / leads, and (lagged / leaded, iterated, quasi-, log-) differences and (compounded) growth rates on (irregular) time series and panel data. Auto-, partial- and cross-correlation functions for panel data. Panel data to (ts-)array conversion.

time-series-panel-series

Time Series and Panel Series

findex_by() findex() unindex() reindex() is_irregular() to_plm() print(<index_df>)

Fast Indexed Time Series and Panels

timeid()

Generate Integer-Id From Time/Date Sequences

flag() L()

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, splitting, extraction/subsetting, apply, and generalized row-binding / unlisting to data frame.

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()

Fast (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 and descriptive tools.

summary-statistics

Summary Statistics

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

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

qtab() qtable()

Fast (Weighted) Cross Tabulation

descr() as.data.frame(<descr>) print(<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

## Other Statistical

Fast euclidean distance computations, (weighted) sample quantiles, and range of vector.

fdist()

Fast and Flexible Distance Computations

fquantile() .quantile() frange() .range()

Fast (Weighted) Sample Quantiles and Range

## 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

## (Memory) Efficient Programming

Functions to make R programming more efficient.

anyv() allv() allNA() whichv() whichNA() %==% %!=% alloc() copyv() setv() setop() %+=% %-=% %*=% %/=% na_rm() na_omit() na_insert() missing_cases() vlengths() vtypes() vgcd() fnlevels() fnrow() fncol() fdim() seq_row() seq_col() cinv()

Small Functions to Make R Programming More Efficient

## Small (Helper) Functions

Convenience functions to perform multiple-assignment, nonstandard concatenation, and deal with variable names, labels, other attributes, matching and object checking, and help with metaprogramming.

.c() %=% massign() vlabels() vlabels<-() setLabels() vclasses() namlab() add_stub() rm_stub() %!in% ckmatch() all_identical() all_obj_equal() all_funs() setRownames() setColnames() setDimnames() unattrib() setAttrib() 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

set_collapse()get_collapse()