Package: collapse 2.0.17
collapse: Advanced and Fast Data Transformation
A C/C++ based package for advanced data transformation and statistical computing in R that is extremely fast, class-agnostic, robust and programmer friendly. Core functionality includes a rich set of S3 generic grouped and weighted statistical functions for vectors, matrices and data frames, which provide efficient low-level vectorizations, OpenMP multithreading, and skip missing values by default. These are integrated with fast grouping and ordering algorithms (also callable from C), and efficient data manipulation functions. The package also provides a flexible and rigorous approach to time series and panel data in R. It further includes fast functions for common statistical procedures, detailed (grouped, weighted) summary statistics, powerful tools to work with nested data, fast data object conversions, functions for memory efficient R programming, and helpers to effectively deal with variable labels, attributes, and missing data. It is well integrated with base R classes, 'dplyr'/'tibble', 'data.table', 'sf', 'units', 'plm' (panel-series and data frames), and 'xts'/'zoo'.
Authors:
collapse_2.0.17.tar.gz
collapse_2.0.17.tar.gz(r-4.5-noble)collapse_2.0.17.tar.gz(r-4.4-noble)
collapse_2.0.17.tgz(r-4.4-emscripten)collapse_2.0.17.tgz(r-4.3-emscripten)
collapse.pdf |collapse.html✨
collapse/json (API)
NEWS
# Install 'collapse' in R: |
install.packages('collapse', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/sebkrantz/collapse/issues
Last updated 19 days agofrom:8234dac029. Checks:OK: 2. Indexed: no.
Target | Result | Date |
---|---|---|
Doc / Vignettes | OK | Nov 04 2024 |
R-4.5-linux-x86_64 | OK | Nov 04 2024 |
Exports:.c.COLLAPSE_ALL.COLLAPSE_DATA.COLLAPSE_GENERIC.COLLAPSE_OLD.COLLAPSE_TOPICS.FAST_FUN.FAST_STAT_FUN.OPERATOR_FUN.quantile.range%-=%%!=%%!iin%%!in%%*=%%/=%%+=%%=%%==%%c-%%c*%%c/%%c+%%cr%%iin%%r-%%r*%%r/%%r+%%rr%add_stubadd_varsadd_vars<-all_funsall_identicalall_obj_equalallNAallocallvany_duplicatedanyvas_character_factoras_factor_GRPas_factor_qGas_integer_factoras_numeric_factoras.character_factoras.factor_GRPas.factor_qGas.numeric_factoratomic_elematomic_elem<-avav<-BBYBY.data.frameBY.defaultBY.matrixcat_varscat_vars<-char_varschar_vars<-cinvckmatchcollapcollapgcollapvcolordercolordervcopyAttribcopyMostAttribcopyvDdapplydate_varsDate_varsdate_vars<-Date_vars<-descrdescr.defaultDlogfact_varsfact_vars<-fbetweenfbetween.data.framefbetween.defaultfbetween.matrixfcomputefcomputevfcountfcountvfcumsumfcumsum.data.framefcumsum.defaultfcumsum.matrixfdifffdiff.data.framefdiff.defaultfdiff.matrixfdimfdistfdroplevelsfdroplevels.data.framefdroplevels.factorfduplicatedffirstffirst.data.frameffirst.defaultffirst.matrixfFtestfFtest.defaultfgroup_byfgroup_varsfgrowthfgrowth.data.framefgrowth.defaultfgrowth.matrixfhdbetweenfHDbetweenfhdbetween.data.framefhdbetween.defaultfhdbetween.matrixfhdwithinfHDwithinfhdwithin.data.framefhdwithin.defaultfhdwithin.matrixfindexfindex_byfinteractionflagflag.data.frameflag.defaultflag.matrixflastflast.data.frameflast.defaultflast.matrixflmflm.defaultfmatchfmaxfmax.data.framefmax.defaultfmax.matrixfmeanfmean.data.framefmean.defaultfmean.matrixfmedianfmedian.data.framefmedian.defaultfmedian.matrixfminfmin.data.framefmin.defaultfmin.matrixfmodefmode.data.framefmode.defaultfmode.matrixfmutatefncolfndistinctfNdistinctfndistinct.data.framefndistinct.defaultfndistinct.matrixfnlevelsfnobsfNobsfnobs.data.framefnobs.defaultfnobs.matrixfnrowfnthfnth.data.framefnth.defaultfnth.matrixfnuniquefprodfprod.data.framefprod.defaultfprod.matrixfquantilefrangefrenamefscalefscale.data.framefscale.defaultfscale.matrixfsdfsd.data.framefsd.defaultfsd.matrixfselectfselect<-fsubsetfsubset.data.framefsubset.defaultfsubset.matrixfsumfsum.data.framefsum.defaultfsum.matrixfsummarisefsummarizeftransformftransform<-ftransformvfungroupfuniquefunique.data.framefunique.defaultfvarfvar.data.framefvar.defaultfvar.matrixfwithinfwithin.data.framefwithin.defaultfwithin.matrixGgbyget_collapseget_elemget_varsget_vars<-greordergroupgroup_by_varsgroupidGRPGRP.defaultGRPidGRPNGRPnamesgsplitgvgv<-gvrgvr<-has_elemHDBHDWibyirreg_elemis_categoricalis_dateis_GRPis_irregularis_qGis_unlistableis.categoricalis.Dateis.GRPis.qGis.unlistableitnixjoinLldepthlist_elemlist_elem<-logi_varslogi_vars<-massignmctlmissing_casesmrtlmttna_focbna_insertna_locfna_omitna_rmnamlabnum_varsnum_vars<-nvnv<-padpivotplot.psmatprint.pwcorprint.pwcovprint.qsupsacfpsacf.data.framepsacf.defaultpsccfpsccf.defaultpsmatpsmat.data.framepsmat.defaultpspacfpspacf.data.framepspacf.defaultpwcorpwcovpwnobspwNobsqDFqDTqFqGqMqsuqsu.data.frameqsu.defaultqsu.matrixqtabqtableqTBLradixorderradixordervrapply2drecode_charrecode_numreg_elemreindexrelabelreplace_infreplace_Infreplace_nareplace_NAreplace_outliersrm_stubrnmrowbindroworderrowordervrsplitrsplit.data.framersplit.defaultrsplit.matrixsbtseq_colseq_rowseqidset_collapsesetattribsetAttribsetColnamessetDimnamessetLabelssetopsetrelabelsetrenamesetRownamessettfmsettfmvsetTRAsettransformsettransformvsetvsltslt<-smrssSTDt_listtfmtfm<-tfmvtimeidto_plmTRATRA.data.frameTRA.defaultTRA.matrixunattribunindexunlist2dvaryingvarying.data.framevarying.defaultvarying.matrixvclassesvecvgcdvlabelsvlabels<-vlengthsvtypesWwhichNAwhichv
Dependencies:Rcpp
collapse and sf
Rendered fromcollapse_and_sf.Rmd
usingknitr::rmarkdown
on Nov 04 2024.Last update: 2024-07-09
Started: 2024-05-25
collapse Documentation and Resources
Rendered fromcollapse_documentation.Rmd
usingknitr::rmarkdown
on Nov 04 2024.Last update: 2024-07-09
Started: 2021-03-02
collapse for tidyverse Users
Rendered fromcollapse_for_tidyverse_users.Rmd
usingknitr::rmarkdown
on Nov 04 2024.Last update: 2024-11-03
Started: 2023-10-14
collapse's Handling of R Objects
Rendered fromcollapse_object_handling.Rmd
usingknitr::rmarkdown
on Nov 04 2024.Last update: 2024-07-09
Started: 2023-05-28
Readme and manuals
Help Manual
Help page | Topics |
---|---|
Advanced and Fast Data Transformation | collapse-package collapse |
Apply Functions Across Multiple Columns | across |
Fast Row/Column Arithmetic for Matrix-Like Objects | %c*% %c+% %c-% %c/% %cr% %r*% %r+% %r-% %r/% %rr% arithmetic |
Split-Apply-Combine Computing | BY BY.data.frame BY.default BY.grouped_df BY.matrix |
Advanced Data Aggregation | A5-advanced-aggregation advanced-aggregation collap collapg collapv |
Collapse Documentation & Overview | .COLLAPSE_ALL .COLLAPSE_DATA .COLLAPSE_GENERIC .COLLAPSE_TOPICS A0-collapse-documentation collapse-documentation |
_collapse_ Package Options | .op AA4-collapse-options collapse-options get_collapse set_collapse |
Renamed Functions | .COLLAPSE_OLD as.character_factor as.factor_GRP as.factor_qG as.numeric_factor collapse-renamed Date_vars Date_vars<- fHDbetween fHDbetween.data.frame fHDbetween.default fHDbetween.grouped_df fHDbetween.matrix fHDbetween.pdata.frame fHDbetween.pseries fHDwithin fHDwithin.data.frame fHDwithin.default fHDwithin.grouped_df fHDwithin.matrix fHDwithin.pdata.frame fHDwithin.pseries fNdistinct fNdistinct.data.frame fNdistinct.default fNdistinct.grouped_df fNdistinct.matrix fNobs fNobs.data.frame fNobs.default fNobs.grouped_df fNobs.matrix is.categorical is.Date is.GRP is.qG is.unlistable pwNobs replace_Inf replace_NA |
Fast Reordering of Data Frame Columns | colorder colorderv |
Data Apply | dapply |
Data Transformations | .OPERATOR_FUN A6-data-transformations data-transformations |
Detailed Statistical Description of Data Frame | as.data.frame.descr descr descr.default descr.grouped_df print.descr [.descr |
Small Functions to Make R Programming More Efficient | %!=% %*=% %+=% %-=% %/=% %==% AA2-efficient-programming allNA alloc allv anyv cinv copyv efficient-programming fdim fncol fnlevels fnrow missing_cases na_focb na_insert na_locf na_omit na_rm seq_col seq_row setop setv vec vgcd vlengths vtypes whichNA whichv |
Fast Data Manipulation | A3-fast-data-manipulation fast-data-manipulation |
Fast Grouping and Ordering | A2-fast-grouping-ordering fast-grouping-ordering |
Fast (Grouped, Weighted) Statistical Functions for Matrix-Like Objects | .FAST_FUN .FAST_STAT_FUN A1-fast-statistical-functions fast-statistical-functions |
Fast Between (Averaging) and (Quasi-)Within (Centering) Transformations | B B.data.frame B.default B.grouped_df B.matrix B.pdata.frame B.pseries fbetween fbetween.data.frame fbetween.default fbetween.grouped_df fbetween.matrix fbetween.pdata.frame fbetween.pseries fwithin fwithin.data.frame fwithin.default fwithin.grouped_df fwithin.matrix fwithin.pdata.frame fwithin.pseries W W.data.frame W.default W.grouped_df W.matrix W.pdata.frame W.pseries |
Efficiently Count Observations by Group | fcount fcountv |
Fast (Grouped, Ordered) Cumulative Sum for Matrix-Like Objects | fcumsum fcumsum.data.frame fcumsum.default fcumsum.grouped_df fcumsum.matrix fcumsum.pdata.frame fcumsum.pseries |
Fast (Quasi-, Log-) Differences for Time Series and Panel Data | D D.data.frame D.default D.grouped_df D.list D.matrix D.pdata.frame D.pseries Dlog Dlog.data.frame Dlog.default Dlog.grouped_df Dlog.list Dlog.matrix Dlog.pdata.frame Dlog.pseries fdiff fdiff.data.frame fdiff.default fdiff.grouped_df fdiff.list fdiff.matrix fdiff.pdata.frame fdiff.pseries |
Fast and Flexible Distance Computations | fdist |
Fast Removal of Unused Factor Levels | fdroplevels fdroplevels.data.frame fdroplevels.factor |
Fast (Grouped) First and Last Value for Matrix-Like Objects | ffirst ffirst.data.frame ffirst.default ffirst.grouped_df ffirst.matrix flast flast.data.frame flast.default flast.grouped_df flast.matrix |
Fast (Weighted) F-test for Linear Models (with Factors) | fFtest fFtest.default fFtest.formula |
Fast Growth Rates for Time Series and Panel Data | fgrowth fgrowth.data.frame fgrowth.default fgrowth.grouped_df fgrowth.list fgrowth.matrix fgrowth.pdata.frame fgrowth.pseries G G.data.frame G.default G.grouped_df G.list G.matrix G.pdata.frame G.pseries |
Higher-Dimensional Centering and Linear Prediction | fhdbetween fhdbetween.data.frame fhdbetween.default fhdbetween.matrix fhdbetween.pdata.frame fhdbetween.pseries fhdwithin fhdwithin.data.frame fhdwithin.default fhdwithin.matrix fhdwithin.pdata.frame fhdwithin.pseries HDB HDB.data.frame HDB.default HDB.matrix HDB.pdata.frame HDB.pseries HDW HDW.data.frame HDW.default HDW.matrix HDW.pdata.frame HDW.pseries |
Fast Lags and Leads for Time Series and Panel Data | F F.data.frame F.default F.grouped_df F.matrix F.pdata.frame F.pseries flag flag.data.frame flag.default flag.grouped_df flag.matrix flag.pdata.frame flag.pseries L L.data.frame L.default L.grouped_df L.matrix L.pdata.frame L.pseries |
Fast (Weighted) Linear Model Fitting | flm flm.default flm.formula |
Fast Matching | %!iin% %!in% %iin% ckmatch fmatch |
Fast (Grouped, Weighted) Mean for Matrix-Like Objects | fmean fmean.data.frame fmean.default fmean.grouped_df fmean.matrix |
Fast (Grouped) Maxima and Minima for Matrix-Like Objects | fmax fmax.data.frame fmax.default fmax.grouped_df fmax.matrix fmin fmin.data.frame fmin.default fmin.grouped_df fmin.matrix |
Fast (Grouped, Weighted) Statistical Mode for Matrix-Like Objects | fmode fmode.data.frame fmode.default fmode.grouped_df fmode.matrix |
Fast (Grouped) Distinct Value Count for Matrix-Like Objects | fndistinct fndistinct.data.frame fndistinct.default fndistinct.grouped_df fndistinct.matrix |
Fast (Grouped) Observation Count for Matrix-Like Objects | fnobs fnobs.data.frame fnobs.default fnobs.grouped_df fnobs.matrix |
Fast (Grouped, Weighted) N'th Element/Quantile for Matrix-Like Objects | fmedian fmedian.data.frame fmedian.default fmedian.grouped_df fmedian.matrix fnth fnth.data.frame fnth.default fnth.grouped_df fnth.matrix |
Fast (Grouped, Weighted) Product for Matrix-Like Objects | fprod fprod.data.frame fprod.default fprod.grouped_df fprod.matrix |
Fast (Weighted) Sample Quantiles and Range | .quantile .range fquantile frange |
Fast Renaming and Relabelling Objects | frename relabel rnm setrelabel setrename |
Fast (Grouped, Weighted) Scaling and Centering of Matrix-like Objects | fscale fscale.data.frame fscale.default fscale.grouped_df fscale.matrix fscale.pdata.frame fscale.pseries STD STD.data.frame STD.default STD.grouped_df STD.matrix STD.pdata.frame STD.pseries |
Fast Select, Replace or Add Data Frame Columns | add_vars add_vars<- av av<- cat_vars cat_vars<- char_vars char_vars<- date_vars date_vars<- fact_vars fact_vars<- fselect fselect<- get_vars get_vars<- gv gv<- gvr gvr<- logi_vars logi_vars<- num_vars num_vars<- nv nv<- slt slt<- |
Fast Subsetting Matrix-Like Objects | fsubset fsubset.data.frame fsubset.default fsubset.matrix fsubset.pdata.frame fsubset.pseries sbt ss |
Fast (Grouped, Weighted) Sum for Matrix-Like Objects | fsum fsum.data.frame fsum.default fsum.grouped_df fsum.matrix |
Fast Summarise | fsummarise fsummarize smr |
Fast Transform and Compute Columns on a Data Frame | fcompute fcomputev fmutate ftransform ftransform<- ftransformv mtt settfm settfmv settransform settransformv tfm tfm<- tfmv |
Fast Unique Elements / Rows | any_duplicated fduplicated fnunique funique funique.data.frame funique.default funique.pdata.frame funique.pseries funique.sf |
Fast (Grouped, Weighted) Variance and Standard Deviation for Matrix-Like Objects | fsd fsd.data.frame fsd.default fsd.grouped_df fsd.matrix fvar fvar.data.frame fvar.default fvar.grouped_df fvar.matrix |
Find and Extract / Subset List Elements | atomic_elem atomic_elem<- get_elem has_elem irreg_elem list_elem list_elem<- reg_elem |
Groningen Growth and Development Centre 10-Sector Database | GGDC10S |
Fast Hash-Based Grouping | group |
Generate Run-Length Type Group-Id | groupid |
Fast Grouping / _collapse_ Grouping Objects | as_factor_GRP fgroup_by fgroup_vars fungroup gby greorder group_by_vars GRP GRP.default GRP.factor GRP.grouped_df GRP.GRP GRP.pdata.frame GRP.pseries GRP.qG GRPid GRPN GRPnames gsplit is_GRP length.GRP plot.GRP print.GRP |
Fast Indexed Time Series and Panels | $.indexed_frame $<-.indexed_frame findex findex_by iby indexing is_irregular ix print.index_df reindex to_plm unindex [.indexed_frame [.indexed_series [.index_df [<-.indexed_frame [[.indexed_frame [[<-.indexed_frame |
Unlistable Lists | is_unlistable |
Fast Table Joins | join |
Determine the Depth / Level of Nesting of a List | ldepth |
List Processing | A8-list-processing list-processing |
Pad Matrix-Like Objects with a Value | pad |
Fast and Easy Data Reshaping | pivot |
Auto- and Cross- Covariance and Correlation Function Estimation for Panel Series | psacf psacf.data.frame psacf.default psacf.pdata.frame psacf.pseries psccf psccf.default psccf.pseries pspacf pspacf.data.frame pspacf.default pspacf.pdata.frame pspacf.pseries |
Matrix / Array from Panel Series | aperm.psmat plot.psmat psmat psmat.data.frame psmat.default psmat.pdata.frame psmat.pseries [.psmat |
(Pairwise, Weighted) Correlations, Covariances and Observation Counts | print.pwcor print.pwcov pwcor pwcov pwnobs |
Fast Factor Generation, Interactions and Vector Grouping | as_factor_qG finteraction is_qG itn qF qG |
Fast (Grouped, Weighted) Summary Statistics for Cross-Sectional and Panel Data | as.data.frame.qsu print.qsu qsu qsu.data.frame qsu.default qsu.grouped_df qsu.matrix qsu.pdata.frame qsu.pseries qsu.sf |
Fast (Weighted) Cross Tabulation | qtab qtable |
Quick Data Conversion | A4-quick-conversion as_character_factor as_integer_factor as_numeric_factor mctl mrtl qDF qDT qM qTBL quick-conversion |
Fast Radix-Based Ordering | radixorder radixorderv |
Recursively Apply a Function to a List of Data Objects | rapply2d |
Recode and Replace Values in Matrix-Like Objects | AA1-recode-replace recode-replace recode_char recode_num replace_inf replace_na replace_outliers |
Row-Bind Lists / Data Frame-Like Objects | rowbind |
Fast Reordering of Data Frame Rows | roworder roworderv |
Fast (Recursive) Splitting | rsplit rsplit.data.frame rsplit.default rsplit.matrix |
Generate Group-Id from Integer Sequences | seqid |
Small (Helper) Functions | %=% .c AA3-small-helpers add_stub all_funs all_identical all_obj_equal copyAttrib copyMostAttrib is_categorical is_date massign namlab rm_stub setAttrib setattrib setColnames setDimnames setLabels setRownames small-helpers unattrib vclasses vlabels vlabels<- |
Summary Statistics | A9-summary-statistics summary-statistics |
Efficient List Transpose | t_list |
Time Series and Panel Series | A7-time-series-panel-series time-series-panel-series |
Generate Integer-Id From Time/Date Sequences | timeid |
Transform Data by (Grouped) Replacing or Sweeping out Statistics | setTRA TRA TRA.data.frame TRA.default TRA.grouped_df TRA.matrix |
Recursive Row-Binding / Unlisting in 2D - to Data Frame | unlist2d |
Fast Check of Variation in Data | varying varying.data.frame varying.default varying.grouped_df varying.matrix varying.pdata.frame varying.pseries varying.sf |
World Development Dataset | wlddev |