-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
summarise()
edge case recycling bug
#6509
Comments
Something seems wrong with the summarise recycling implementation because it is treating data frames with 0 cols as "not useful" chunks, when they definitely are Line 60 in 9473bec
|
Probably related bug: library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
starwars %>% summarize(sum_height = sum(height, na.rm = TRUE))
#> # A tibble: 1 × 1
#> sum_height
#> <int>
#> 1 14123
starwars %>% summarize(sum_height = sum(height, na.rm = TRUE), mean_height = sum(height, na.rm = TRUE) / nrow(height))
#> # A tibble: 0 × 2
#> # … with 2 variables: sum_height <int>, mean_height <dbl> Created on 2022-11-14 by the reprex package (v2.0.1) I would have expected the second dataframe to either have one row with the sum and some sort of missing value, or error. |
This is more related to #6382 where some people disagree with |
Created on 2022-10-18 with reprex v2.0.2.9000
The text was updated successfully, but these errors were encountered: