Learn R Programming

collapse (version 1.8.9)

collapse-documentation: Collapse Documentation & Overview

Description

The following table fully summarizes the contents of collapse. The documentation is structured hierarchically: This is the main overview page, linking to topical overview pages and associated function pages (unless functions are documented on the topic page).

Arguments

Topics and Functions

Topic Main Features / Keywords Functions

Fast Statistical FunctionsFast (grouped and weighted) statistical functions for vector, matrix, data frame and grouped data frames (class 'grouped_df', dplyr compatible).fsum, fprod, fmean, fmedian, fmode, fvar, fsd, fmin, fmax, fnth, ffirst, flast, fnobs, fndistinct Fast Grouping and OrderingFast (ordered) groupings from vectors, data frames, lists. 'GRP' objects are efficient inputs for programming with collapse's fast functions. fgroup_by can attach them to a data frame, for fast dplyr-style grouped computations. Fast splitting of vectors based on 'GRP' objects. Fast radix-based ordering and hash-based grouping (the workhorses behind GRP). Fast unique values/rows, factor generation, vector grouping, interactions, dropping unused factor levels, generalized run-length type grouping and grouping of integer sequences and time vectors. GRP, as_factor_GRP, GRPN, GRPnames, is_GRP, fgroup_by, fgroup_vars, fungroup, gsplit, greorder, radixorder(v), group, funique, fnunique, qF, qG, is_qG, finteraction, fdroplevels, groupid, seqid, timeid

Fast Data Manipulation Fast and flexible select, subset, summarise, mutate/transform, sort/reorder, rename and relabel data. Some functions modify by reference and/or allow assignment. In addition a set of (standard evaluation) functions for fast selecting, replacing or adding data frame columns, including shortcuts to select and replace variables by data type.fselect(<-), fsubset/ss, fsummarise, fmutate, across, (f/set)transform(v)(<-), fcompute(v), roworder(v), colorder(v), (f/set)rename, (set)relabel, get_vars(<-), add_vars(<-), num_vars(<-), cat_vars(<-), char_vars(<-), fact_vars(<-), logi_vars(<-), date_vars(<-) Quick Data ConversionQuick conversions: data.frame <> data.table <> tibble <> matrix (row- or column-wise) <> list | array > matrix, data.frame, data.table, tibble | vector > factor, matrix, data.frame, data.table, tibble; and converting factors / all factor columns. qDF, qDT, qTBL, qM, qF, mrtl, mctl, as_numeric_factor, as_character_factorAdvanced Data Aggregation Fast and easy (weighted and parallelized) aggregation of multi-type data, with different functions applied to numeric and categorical variables. Custom specifications allow mappings of functions to variables + renaming.collap(v/g) Data TransformationsFast row- and column- arithmetic and (object preserving) apply functionality for vectors, matrices and data frames. Fast (grouped) replacing and sweeping of statistics (by reference) and (grouped and weighted) scaling / standardizing, (higher-dimensional) between- and within-transformations (i.e. averaging and centering), linear prediction and partialling out. %(r/c)r%, %(r/c)(+/-/*//)%, dapply, BY, (set)TRA, fscale/STD, fbetween/B, fwithin/W, fhdbetween/HDB, fhdwithin/HDW Linear ModelsFast (weighted) linear model fitting with 6 different solvers and a fast F-test to test exclusion restrictions on linear models with (large) factors. flm, fFtestTime Series and Panel Series Fast and class-agnostic indexed time series and panel data objects, check for irregularity in time series and panels, and efficient time-sequence to integer/factor conversion. Fast (sequences of) lags / leads and (lagged / leaded and iterated, quasi-, log-) differences, and (compounded) growth rates on (irregular) time series and panel data. Flexible cumulative sums. Panel data to array conversions. Multivariate panel- auto-, partial- and cross-correlation functions. findex_by, findex, unindex, reindex, is_irregular, to_plm, timeid, flag/L/F, fdiff/D/Dlog, fgrowth/G, fcumsum, psmat, psacf, pspacf, psccfList Processing (Recursive) list search and checks, extraction of list-elements / list-subsetting, fast (recursive) splitting, list-transpose, apply functions to lists of data frames / data objects, and generalized recursive row-binding / unlisting in 2-dimensions / to data frame.is_unlistable, ldepth, has_elem, get_elem, atomic_elem(<-), list_elem(<-), reg_elem, irreg_elem, rsplit, t_list, rapply2d, unlist2dSummary Statistics Fast (grouped and weighted) summary statistics for cross-sectional and panel data. Fast (weighted) cross tabulation. Efficient detailed description of data frame. Fast check of variation in data (within groups / dimensions). (Weighted) pairwise correlations and covariances (with obs. and p-value), pairwise observation count. qsu, qtab, descr, varying, pwcor, pwcov, pwnobs

Recode and Replace ValuesRecode multiple values (exact or regex matching) and replace NaN/Inf/-Inf and outliers (according to 1- or 2-sided threshold or standard-deviations) in vectors, matrices or data frames. Insert a value at arbitrary positions into vectors, matrices or data frames. recode_num, recode_char, replace_NA, replace_Inf, replace_outliers, pad(Memory) Efficient Programming Efficient comparisons of a vector/matrix with a value, and replacing values/rows in vector/matrix/DF (avoiding logical vectors or subsets), faster generation of initialized vectors, and fast mathematical operations on vectors/matrices/DF's with no copies at all. Fast missing value detection, (random) insertion and removal, lengths and C storage types, greatest common divisor and range of vector, nlevels for factors, nrow, ncol, dim (for data frames) and seq_along rows or columns. Choleski (fast) inverse of symmetric PD matrix.anyv, allv, allNA, whichv, whichNA, %==%, %!=%, copyv, setv, alloc, setop, %+=%, %-=%, %*=%, %/=%, missing_cases, na_insert, na_rm, na_omit, vlengths, vtypes, vgcd, frange, fnlevels, fnrow, fncol, fdim, seq_row, seq_col, cinv Small (Helper) FunctionsMultiple-assignment, non-standard concatenation, set and extract variable labels and classes, display variable names and labels together, add / remove prefix or postfix to / from column names, not-in operator, matching with error message for non-matched, check exact or near / numeric equality of multiple objects or of all elements in a list, get names of functions called in an expression, return object with dimnames, row- or colnames efficiently set, or with all attributes removed, C-level functions to set and shallow-copy attributes, identify categorical (non-numeric) and date(-time) objects. massign, %=%, .c, vlabels(<-), setLabels, vclasses, namlab, add_stub, rm_stub, %!in%, ckmatch, all_identical, all_obj_equal, all_funs, setDimnames, setRownames, setColnames, unattrib, setAttrib, setattrib, copyAttrib, copyMostAttrib, is_categorical, is_dateData and Global Macros Groningen Growth and Development Centre 10-Sector Database, World Bank World Development dataset, and some global macros containing links to the topical documentation pages (including this page), all exported objects (excluding exported S3 methods and depreciated functions), all generic functions (excluding depreciated), the 2 datasets, all fast functions, all fast statistical (scalar-valued) functions, and all transformation operators (these are not infix functions but function shortcuts resembling operators in a statistical sense, such as the lag/lead operators L/F, both wrapping flag, see .OPERATOR_FUN).GGDC10S, wlddev, .COLLAPSE_TOPICS, .COLLAPSE_ALL, .COLLAPSE_GENERIC, .COLLAPSE_DATA, .FAST_FUN, .FAST_STAT_FUN, .OPERATOR_FUN

Package Options

  • options("collapse_unused_arg_action") sets the action taken by generic statistical functions when unknown arguments are passed to a method. The default is "warning".

  • options("collapse_mask") can be used to export copies of functions starting with "f" when loading the package, removing the leading "f" (e.g. also exporting subset as a clone to fsubset). This will mask like-named base R or dplyr functions.

  • options("collapse_F_to_FALSE") can also be called before loading the package to set the lead operator F in the package to FALSE, to avoid problems with base::F.

Author

Maintainer: Sebastian Krantz sebastian.krantz@graduateinstitute.ch

Details

The added top-level documentation infrastructure in collapse allows you to effectively navigate the package. Calling ?FUN brings up the documentation page documenting the function, which contains links to associated topic pages and closely related functions. You can also call topical documentation pages directly from the console. The links to these pages are contained in the global macro .COLLAPSE_TOPICS (e.g. calling help(.COLLAPSE_TOPICS[1]) brings up this page).

See Also

collapse-package