-
Notifications
You must be signed in to change notification settings - Fork 41
feat: Implement <group_by/lazy_group_by>$len()
#1638
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
Conversation
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.
Pull Request Overview
This PR implements the len() method for both GroupBy and LazyGroupBy classes to return the number of rows in each group, contributing to issue #1397.
Key Changes
- Added
<group_by>$len()and<lazy_group_by>$len()methods that return row counts per group - Included optional
nameparameter to customize the output column name (defaults to "len") - Comprehensive test coverage with both valid usage and error cases
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| R/lazyframe-group_by.R | Implements lazygroupby__len() method with proper documentation |
| R/dataframe-group_by-general.R | Implements groupby__len() method with documentation inheritance issue |
| man/lazygroupby__len.Rd | Generated documentation for lazy group_by len method |
| man/groupby__len.Rd | Generated documentation for group_by len method (contains incorrect title due to wrong inheritance) |
| tests/testthat/test-lazyframe-frame.R | Adds comprehensive tests for both DataFrame and LazyFrame via expect_query_equal |
| tests/testthat/_snaps/lazyframe-frame.md | Captures expected error messages for invalid parameter types |
| altdoc/mkdocs.yml | Updates navigation to include new len methods in documentation |
| NEWS.md | Documents the new feature in changelog |
eitsupi
left a comment
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.
Thank you.
I know this is a little late, but the methods for groupby and lazygroupby are exactly the same, so doing something like groupby__len <- lazygroupby__len seems sufficient.
|
Ah yes indeed, it seems this is the case for many (all?) group_by functions. Is it fine if I do this change everywhere possible in a followup PR? |
|
That's good, thanks. I'll merge it for now. |
Part of #1397