Skip to content

Commit

Permalink
Fix summarise()
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Oct 15, 2023
1 parent abfab53 commit 01fbabd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions R/summarise.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ summarise.duckplyr_df <- function(.data, ..., .by = NULL, .groups = NULL) {
# dplyr forward
summarise <- dplyr$summarise.data.frame
out <- summarise(.data, ..., .by = {{ .by }}, .groups = .groups)
# dplyr_reconstruct() is not called here, restoring manually
if (!identical(.groups, "rowwise")) {
class(out) <- class(.data)
}
return(out)

# dplyr implementation
Expand Down
13 changes: 12 additions & 1 deletion patch/summarise.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git b/R/summarise.R a/R/summarise.R
index 79ffb8a..a42fc05 100644
index 79ffb8a..5589cfc 100644
--- b/R/summarise.R
+++ a/R/summarise.R
@@ -1,10 +1,52 @@
Expand Down Expand Up @@ -57,3 +57,14 @@ index 79ffb8a..a42fc05 100644
return(out)
}
)
@@ -12,6 +54,10 @@ summarise.duckplyr_df <- function(.data, ..., .by = NULL, .groups = NULL) {
# dplyr forward
summarise <- dplyr$summarise.data.frame
out <- summarise(.data, ..., .by = {{ .by }}, .groups = .groups)
+ # dplyr_reconstruct() is not called here, restoring manually
+ if (!identical(.groups, "rowwise")) {
+ class(out) <- class(.data)
+ }
return(out)

# dplyr implementation

0 comments on commit 01fbabd

Please sign in to comment.