-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Draft new data_summary()
function
#482
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #482 +/- ##
==========================================
+ Coverage 90.34% 90.47% +0.13%
==========================================
Files 73 74 +1
Lines 5696 5776 +80
==========================================
+ Hits 5146 5226 +80
Misses 550 550 ☔ View full report in Codecov by Sentry. |
I moved some of the code from |
Some examples with NA values: library(datawizard)
data(efc, package = "datawizard")
data_summary(efc, MW = mean(c12hour, na.rm = TRUE), by = "c172code")
#> c172code | MW
#> ----------------
#> 1 | 87.12
#> 2 | 94.05
#> 3 | 75.00
#> <NA> | 47.80
data_summary(efc, MW = mean(c12hour, na.rm = TRUE), by = "c172code", include_na = FALSE)
#> c172code | MW
#> ----------------
#> 1 | 87.12
#> 2 | 94.05
#> 3 | 75.00
data_summary(efc, MW = mean(c12hour, na.rm = TRUE), by = c("e42dep", "c172code"))
#> e42dep | c172code | MW
#> --------------------------
#> 1 | 2 | 17.00
#> 2 | 2 | 34.25
#> 3 | 1 | 39.50
#> 3 | 2 | 52.44
#> 3 | 3 | 52.00
#> 3 | <NA> | 84.00
#> 4 | 1 | 134.75
#> 4 | 2 | 119.26
#> 4 | 3 | 88.80
#> 4 | <NA> | 43.29
#> <NA> | 2 | <NA>
#> <NA> | <NA> | 7.00 Created on 2024-03-03 with reprex v2.1.0 |
Would be nice to make it compatible with our dataframe-returning functions, like |
See #483 I guess this would require special handling for these "exceptions" (separate handling for each special class). But let's first finish this PR. |
@etiennebacher if you want to review this PR, please wait until all checks pass. |
Yes I'll review it in a couple of hours |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @strengejacke, LGTM but I have a few comments
Equvalent to
dplyr::summarise()
Created on 2024-03-03 with reprex v2.1.0