Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ preferred-citation:
url: https://arxiv.org/abs/2403.05038
repository: https://CRAN.R-project.org/package=collapse
repository-code: https://github.com/fastverse/collapse
url: https://fastverse.github.io/collapse/
url: https://fastverse.org/collapse/
date-released: '2025-05-24'
contact:
- family-names: Krantz
Expand Down Expand Up @@ -78,7 +78,7 @@ references:
year: '2025'
notes: R package version 2.1.5.9000
doi: 10.5281/zenodo.8433090
url: https://fastverse.github.io/collapse/
url: https://fastverse.org/collapse/
- type: software
title: 'R: A Language and Environment for Statistical Computing'
notes: Depends
Expand Down Expand Up @@ -166,7 +166,7 @@ references:
abstract: 'fastverse: A Suite of High-Performance Packages for Statistics and Data
Manipulation'
notes: Suggests
url: https://fastverse.github.io/fastverse/
url: https://fastverse.org/fastverse/
repository: https://CRAN.R-project.org/package=fastverse
authors:
- family-names: Krantz
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Description: A large C/C++-based package for advanced data transformation and
helpers to effectively deal with variable labels, attributes, and missing data. It
seamlessly supports base R objects/classes as well as 'units', 'integer64', 'xts'/
'zoo', 'tibble', 'grouped_df', 'data.table', 'sf', and 'pseries'/'pdata.frame'.
URL: https://fastverse.github.io/collapse/, https://github.com/fastverse/collapse
URL: https://fastverse.org/collapse/, https://github.com/fastverse/collapse
BugReports: https://github.com/fastverse/collapse/issues
License: GPL (>= 2) | file LICENSE
Encoding: UTF-8
Expand Down
21 changes: 13 additions & 8 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# collapse 2.1.5.9000

* The repo has moved to `fastverse/collapse`, for better visibility and maintenance. Selected people now have access to the repo through the organization account and may respond to issues or submit fixes.
* The repo has moved to `fastverse/collapse` and the website to [fastverse.org/collapse](https://fastverse.org/collapse/)---for better visibility and maintenance. Appropriate redirects from the old repo/site have been implemented.
Selected people now have access to the repo through the organization account and may respond to issues or submit fixes.

* Fixed bug in `pivot(..., how = "wider", FUN = "sum")` (using internal sum function) when columns to aggregate were integer typed. Thanks @ummel (#803).
* *collapse* now treats `-0` and `0` as the same value in hash functions (`funique()`, `group()`, `fmatch()`, `fndistinct()`, `fmode()`, and all higher-level derivatives). This is implemented by adding a value of `0.0` to double values before hashing them, and has a small (~3%) performance penalty when hashing doubles. It is implemented in synch with an [equivalent change in *Rcpp*](https://github.com/RcppCore/Rcpp/issues/1340). Thanks @mayer79 for reporting and helping with benchmarking the performance implications (#648).

* Fixed a bug in `pivot(..., how = "wider", FUN = "sum")` (using internal sum function) when columns to aggregate were integer typed. Thanks @ummel (#803).

* Fixed a bug in `roworderv(..., neworder = indices)`, which segfaulted if `indices` were out of range. Thanks @JanMarvin (#807).

* Faster installation from source thanks to the `#include <Rcpp/Lighter>` option in *Rcpp* which loads only part of the header files. Thanks @eddelbuettel for the hint.

Expand Down Expand Up @@ -85,7 +90,7 @@ join(df1, df2, require = list(x = 0.8, fail = "warning"))

* `fmatch(factor(NA), NA)` now gives `1` instead of `NA`. Thanks @NicChr (#675).

* New developer focused vignette on [developing with *collapse*](https://fastverse.github.io/collapse/articles/developing_with_collapse.html).
* New developer focused vignette on [developing with *collapse*](https://fastverse.org/collapse/articles/developing_with_collapse.html).

* Fixed minor CRAN issues (#676, #702).

Expand Down Expand Up @@ -187,7 +192,7 @@ join(df1, df2, require = list(x = 0.8, fail = "warning"))

# collapse 2.0.13

* *collapse* now explicitly supports *xts*/*zoo* and *units* objects and concurrently removes an additional check in the `.default` method of statistical functions that called the matrix method if `is.matrix(x) && !inherits(x, "matrix")`. This was a smart solution to account for the fact that *xts* objects are matrix-based but don't inherit the `"matrix"` class, thus wrongly calling the default method. The same is the case for *units*, but here, my recent more intensive engagement with spatial data convinced me that this should be changed. For one, under the previous heuristic solution, it was not possible to call the default method on a *units* matrix, e.g., `fmean.default(st_distance(points_sf))` called `fmean.matrix()` and yielded a vector. This should not be the case. Secondly, aggregation e.g. `fmean(st_distance(points_sf))` or `fmean(st_distance(points_sf), g = group_vec)` yielded a plain numeric object that lost the *units* class (in line with the [general attribute handling principles](https://fastverse.github.io/collapse/articles/collapse_object_handling.html#general-principles)). Therefore, I have now decided to remove the heuristic check within the default methods, and explicitly support *zoo* and *units* objects. For [*Fast Statistical Functions*](https://fastverse.github.io/collapse/reference/fast-statistical-functions.html), the methods are `FUN.zoo <- function(x, ...) if(is.matrix(x)) FUN.matrix(x, ...) else FUN.default(x, ...)` and `FUN.units <- function(x, ...) if(is.matrix(x)) copyMostAttrib(FUN.matrix(x, ...), x) else FUN.default(x, ...)`. While the behavior for *xts*/*zoo* remains the same, the behavior for *units* is enhanced, as now the class is preserved in aggregations (the [`.default` method preserves attributes except for *ts*](https://fastverse.github.io/collapse/articles/collapse_object_handling.html#general-principles)), and it is possible to manually invoke the `.default` method on a units matrix and obtain an aggregate statistic. This change may impact computations on other matrix based classes which don't inherit from `"matrix"` (*mts* does inherit from `"matrix"`, and I am not aware of any other affected classes, but user code like `m <- matrix(rnorm(25), 5); class(m) <- "bla"; fmean(m)` will now yield a scalar instead of a vector. Such code must be adjusted to either `class(m) <- c("bla", "matrix")` or `fmean.matrix(m)`). Overall, the change makes *collapse* behave in a more standard and predictable way, and enhances its support for *units* objects central in the *sf* ecosystem.
* *collapse* now explicitly supports *xts*/*zoo* and *units* objects and concurrently removes an additional check in the `.default` method of statistical functions that called the matrix method if `is.matrix(x) && !inherits(x, "matrix")`. This was a smart solution to account for the fact that *xts* objects are matrix-based but don't inherit the `"matrix"` class, thus wrongly calling the default method. The same is the case for *units*, but here, my recent more intensive engagement with spatial data convinced me that this should be changed. For one, under the previous heuristic solution, it was not possible to call the default method on a *units* matrix, e.g., `fmean.default(st_distance(points_sf))` called `fmean.matrix()` and yielded a vector. This should not be the case. Secondly, aggregation e.g. `fmean(st_distance(points_sf))` or `fmean(st_distance(points_sf), g = group_vec)` yielded a plain numeric object that lost the *units* class (in line with the [general attribute handling principles](https://fastverse.org/collapse/articles/collapse_object_handling.html#general-principles)). Therefore, I have now decided to remove the heuristic check within the default methods, and explicitly support *zoo* and *units* objects. For [*Fast Statistical Functions*](https://fastverse.org/collapse/reference/fast-statistical-functions.html), the methods are `FUN.zoo <- function(x, ...) if(is.matrix(x)) FUN.matrix(x, ...) else FUN.default(x, ...)` and `FUN.units <- function(x, ...) if(is.matrix(x)) copyMostAttrib(FUN.matrix(x, ...), x) else FUN.default(x, ...)`. While the behavior for *xts*/*zoo* remains the same, the behavior for *units* is enhanced, as now the class is preserved in aggregations (the [`.default` method preserves attributes except for *ts*](https://fastverse.org/collapse/articles/collapse_object_handling.html#general-principles)), and it is possible to manually invoke the `.default` method on a units matrix and obtain an aggregate statistic. This change may impact computations on other matrix based classes which don't inherit from `"matrix"` (*mts* does inherit from `"matrix"`, and I am not aware of any other affected classes, but user code like `m <- matrix(rnorm(25), 5); class(m) <- "bla"; fmean(m)` will now yield a scalar instead of a vector. Such code must be adjusted to either `class(m) <- c("bla", "matrix")` or `fmean.matrix(m)`). Overall, the change makes *collapse* behave in a more standard and predictable way, and enhances its support for *units* objects central in the *sf* ecosystem.

* `fquantile()` now also preserves the attributes of the input, in line with `quantile()`.

Expand Down Expand Up @@ -352,7 +357,7 @@ HDB(mtcars, mpg ~ carb*qF(cyl) + qF(vs) + qF(am))

# collapse 1.9.6

* New vignette on [*collapse*'s Handling of R Objects](https://fastverse.github.io/collapse/articles/collapse_object_handling.html): provides an overview of collapse’s (internal) class-agnostic R programming framework.
* New vignette on [*collapse*'s Handling of R Objects](https://fastverse.org/collapse/articles/collapse_object_handling.html): provides an overview of collapse’s (internal) class-agnostic R programming framework.

* `print.descr()` with groups and option `perc = TRUE` (the default) also shows percentages of the group frequencies for each variable.

Expand Down Expand Up @@ -661,7 +666,7 @@ For example, take the `.OPERATOR_FUN` such as `W()` for within-transforming/cent

* `whichv` (and operators `%==%`, `%!=%`) now also support comparisons of equal-length arguments e.g. `1:3 %==% 1:3`. Note that this should not be used to compare 2 factors.

* Added some code to the `.onLoad` function that checks for the existence of a `.fastverse` configuration file containing a setting for `_opt_collapse_mask`: If found the code makes sure that the option takes effect before the package is loaded. This means that inside projects using the *fastverse* and `options("collapse_mask")` to replace base R / *dplyr* functions, *collapse* cannot be loaded without the masking being applied, making it more secure to utilize this feature. For more information about function masking see `help("collapse-options")` and for `.fastverse` configuration files see the [fastverse vignette](https://fastverse.github.io/fastverse/articles/fastverse_intro.html#custom-fastverse-configurations-for-projects).
* Added some code to the `.onLoad` function that checks for the existence of a `.fastverse` configuration file containing a setting for `_opt_collapse_mask`: If found the code makes sure that the option takes effect before the package is loaded. This means that inside projects using the *fastverse* and `options("collapse_mask")` to replace base R / *dplyr* functions, *collapse* cannot be loaded without the masking being applied, making it more secure to utilize this feature. For more information about function masking see `help("collapse-options")` and for `.fastverse` configuration files see the [fastverse vignette](https://fastverse.org/fastverse/articles/fastverse_intro.html#custom-fastverse-configurations-for-projects).

* Added hidden `.list` methods for `fhdwithin/HDW` and `fhdbetween/HDB`. As for the other `.FAST_FUN` this is just a wrapper for the data frame method and meant to be used on unclassed data frames.

Expand Down Expand Up @@ -1010,7 +1015,7 @@ A small patch for 1.5.0 that:

<!-- Missing value removal is still done using *data.table* source code, so these functions are now equipped for large and complex linear prediction and partialling-out problems. To fully utilize them users must install *fixest*. -->

* Vignettes were outsourced to the [website](<https://fastverse.github.io/collapse/articles/index.html>). This nearly halves the size of the source package, and should induce users to appreciate the built-in documentation. The website also makes for much more convenient reading and navigation of these book-style vignettes.
* Vignettes were outsourced to the [website](<https://fastverse.org/collapse/articles/index.html>). This nearly halves the size of the source package, and should induce users to appreciate the built-in documentation. The website also makes for much more convenient reading and navigation of these book-style vignettes.

<!-- , and also made available as PDF versions for download there -->

Expand All @@ -1022,7 +1027,7 @@ A small patch for 1.5.0 that:

* Added function `allNA` for atomic vectors.

* New vignette about using *collapse* together with *data.table*, available [online](<https://fastverse.github.io/collapse/articles/index.html>).
* New vignette about using *collapse* together with *data.table*, available [online](<https://fastverse.org/collapse/articles/index.html>).

### Improvements

Expand Down
6 changes: 4 additions & 2 deletions R/roworder_colorder_rename.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ posord <- function(sq, o, pos) switch(pos,
stop("pos must be 'front', 'end', 'exchange' or 'after'."))

roworderv <- function(X, cols = NULL, neworder = NULL, decreasing = FALSE, na.last = TRUE, pos = "front", verbose = .op[["verbose"]]) {
if(is.null(neworder)) {
ncheck <- is.null(neworder)
if(ncheck) {
check <- FALSE
if(is.null(cols)) {
if(inherits(X, "sf")) {
Xo <- X
Expand All @@ -64,7 +66,7 @@ roworderv <- function(X, cols = NULL, neworder = NULL, decreasing = FALSE, na.la
if(length(neworder) != fnrow(X)) neworder <- posord(seq_row(X), neworder, pos)
}
rn <- attr(X, "row.names")
res <- .Call(C_subsetDT, X, neworder, seq_along(unclass(X)), FALSE)
res <- .Call(C_subsetDT, X, neworder, seq_along(unclass(X)), !ncheck)
if(!(is.numeric(rn) || is.null(rn) || rn[1L] == "1")) attr(res, "row.names") <- Csv(rn, neworder)
clx <- oldClass(X)
if(any(clx == "pdata.frame")) {
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Facilitate complex data transformation, exploration and computing tasks in R.
* Help make R code fast, flexible, parsimonious and programmer friendly.

Its novel [class-agnostic architecture](https://fastverse.github.io/collapse/articles/collapse_object_handling.html) supports all basic R objects and their popular extensions, including *units*, *integer64*, *xts*/*zoo*, *tibble*, *grouped_df*, *data.table*, *sf*, *pseries* and *pdata.frame*.
Its novel [class-agnostic architecture](https://fastverse.org/collapse/articles/collapse_object_handling.html) supports all basic R objects and their popular extensions, including *units*, *integer64*, *xts*/*zoo*, *tibble*, *grouped_df*, *data.table*, *sf*, *pseries* and *pdata.frame*.



Expand Down Expand Up @@ -69,9 +69,9 @@ install.packages("https://cran.r-project.org/src/contrib/Archive/collapse/collap

## Documentation

*collapse* installs with a built-in structured [documentation](<https://fastverse.github.io/collapse/reference/collapse-documentation.html>), implemented via a set of separate help pages. Calling `help('collapse-documentation')` brings up the the top-level documentation page, providing an overview of the entire package and links to all other documentation pages.
*collapse* installs with a built-in structured [documentation](<https://fastverse.org/collapse/reference/collapse-documentation.html>), implemented via a set of separate help pages. Calling `help('collapse-documentation')` brings up the the top-level documentation page, providing an overview of the entire package and links to all other documentation pages.

In addition there are several [vignettes](<https://fastverse.github.io/collapse/articles/index.html>), among them one on [Documentation and Resources](https://fastverse.github.io/collapse/articles/collapse_documentation.html).
In addition there are several [vignettes](<https://fastverse.org/collapse/articles/index.html>), among them one on [Documentation and Resources](https://fastverse.org/collapse/articles/collapse_documentation.html).

### Cheatsheet

Expand Down Expand Up @@ -300,7 +300,7 @@ pwcor(W(pdata, keep.ids = FALSE), P = TRUE) # Within-correlations
</details>
<p> </p>

Evaluated and more extensive sets of examples are provided on the [package page](<https://fastverse.github.io/collapse/reference/collapse-package.html>) (also accessible from R by calling `example('collapse-package')`), and further in the [vignettes](<https://fastverse.github.io/collapse/articles/index.html>) and [documentation](<https://fastverse.github.io/collapse/reference/index.html>).
Evaluated and more extensive sets of examples are provided on the [package page](<https://fastverse.org/collapse/reference/collapse-package.html>) (also accessible from R by calling `example('collapse-package')`), and further in the [vignettes](<https://fastverse.org/collapse/articles/index.html>) and [documentation](<https://fastverse.org/collapse/reference/index.html>).

## Citation

Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: https://fastverse.github.io/collapse/
url: https://fastverse.org/collapse/
destination: docs

home:
Expand Down
4 changes: 2 additions & 2 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ bibentry(bibtype = "Manual",
year = year,
note = note,
doi = "10.5281/zenodo.8433090",
url = "https://fastverse.github.io/collapse/",
url = "https://fastverse.org/collapse/",
textVersion = paste0("Krantz (", year, "). collapse: Advanced and Fast Data Transformation in R. ", note,
". doi:10.5281/zenodo.8433090. https://fastverse.github.io/collapse/."))
". doi:10.5281/zenodo.8433090. https://fastverse.org/collapse/."))
2 changes: 1 addition & 1 deletion man/collapse-options.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Setting keywords "fast-fun", "fast-stat-fun", "fast-trfm-fun" or "all" with \cod

\emph{Note} also that masking does not change documentation links, so you need to look up the f- version of a function to get the right documentation.

A safe way to set options affecting startup behavior is by using a \code{\link{.Rprofile}} file in your user or project directory (see also \href{https://www.datacamp.com/doc/r/customizing}{here}, the user-level file is located at \code{file.path(Sys.getenv("HOME"), ".Rprofile")} and can be edited using \code{file.edit(Sys.getenv("HOME"), ".Rprofile")}), or by using a \href{https://fastverse.github.io/fastverse/articles/fastverse_intro.html#custom-fastverse-configurations-for-projects}{\code{.fastverse}} configuration file in the project directory.
A safe way to set options affecting startup behavior is by using a \code{\link{.Rprofile}} file in your user or project directory (see also \href{https://www.datacamp.com/doc/r/customizing}{here}, the user-level file is located at \code{file.path(Sys.getenv("HOME"), ".Rprofile")} and can be edited using \code{file.edit(Sys.getenv("HOME"), ".Rprofile")}), or by using a \href{https://fastverse.org/fastverse/articles/fastverse_intro.html#custom-fastverse-configurations-for-projects}{\code{.fastverse}} configuration file in the project directory.

\code{options("collapse_remove")} does in fact remove functions from the namespace and cannot be reversed by \code{set_collapse(remove = NULL)} once the package is loaded. It is only reversed by re-loading \emph{collapse}.
}
Expand Down
Loading
Loading