Skip to content

Commit 4c0501f

Browse files
authored
Merge pull request #671 from SebKrantz/development
Development
2 parents a075c1c + aa517c1 commit 4c0501f

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

DESCRIPTION

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: collapse
22
Title: Advanced and Fast Data Transformation
3-
Version: 2.0.17.9000
4-
Date: 2024-11-19
3+
Version: 2.0.18
4+
Date: 2024-11-23
55
Authors@R: c(
66
person("Sebastian", "Krantz", role = c("aut", "cre"),
77
email = "[email protected]",

NEWS.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# collapse 2.0.17.9000
1+
# collapse 2.0.18
22

33
* Cases in `pivot(..., how = "longer")` with no `values` columns now no longer give an error. Thanks @alvarocombo for flagging this (#663).
44

55
* Fixed bug in `qF(c(4L, 1L, NA), sort = FALSE)`: hash function failure due to a coding bug. Thanks @mayer79 for flagging this (#666).
66

7+
* If `x` is already a `qG` object of the right properties, calling `qG(x)` now does not copy `x` anymore. Thanks @mayer79 (https://github.com/mayer79/effectplots/issues/11).
8+
79
# collapse 2.0.17
810

911
* In `GRP.default()`, the `"group.starts"` attribute is always returned, even if there is only one group or every observation is its own group. Thanks @JamesThompsonC (#631).

R/GRP.R

+1
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ qG <- function(x, ordered = FALSE, na.exclude = TRUE, sort = .op[["sort"]],
732732
ax <- if(return.groups) list(N.groups = attr(x, "N.groups"), groups = attr(x, "groups"), class = newclx) else
733733
list(N.groups = attr(x, "N.groups"), class = newclx)
734734
}
735+
if(identical(ax, attributes(x))) return(x)
735736
return(`attributes<-`(x, ax))
736737
}
737738
newclx <- c(if(ordered) "ordered", "qG", "na.included")

src/data.table_subset.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ static SEXP shallow(SEXP dt, SEXP cols, R_len_t n)
8282
SEXP newdt = PROTECT(allocVector(VECSXP, n)); protecti++; // to do, use growVector here?
8383
SET_ATTRIB(newdt, shallow_duplicate(ATTRIB(dt)));
8484
SET_OBJECT(newdt, OBJECT(dt));
85-
if(IS_S4_OBJECT(dt)) newdt = asS4(newdt, TRUE, 1); // To support S4 objects that include data.table
85+
if(IS_S4_OBJECT(dt)) {
86+
newdt = PROTECT(asS4(newdt, TRUE, 1)); protecti++; // To support S4 objects that include data.table
87+
}
8688
//SHALLOW_DUPLICATE_ATTRIB(newdt, dt); // SHALLOW_DUPLICATE_ATTRIB would be a bit neater but is only available from R 3.3.0
8789

8890
// TO DO: keepattr() would be faster, but can't because shallow isn't merely a shallow copy. It

0 commit comments

Comments
 (0)