nealrichardson commented on code in PR #13934:
URL: https://github.com/apache/arrow/pull/13934#discussion_r991547409


##########
r/R/dplyr-summarize.R:
##########
@@ -159,6 +159,13 @@ register_bindings_aggregate <- function() {
       options = list(skip_nulls = na.rm, min_count = 0L)
     )
   })
+  register_binding_agg("one", function(...) {

Review Comment:
   This is interesting. One question about this approach: do we actually want 
the `one()` function to be callable directly by users? I.e. should something 
like this work?
   
   ```
   mtcars |>
     arrow_table |>
     summarize(
       avg = mean(hp),
       a_value = one(wt)
     )
   ```
   
   I don't know that that's sensible, but maybe someone could come up with a 
reason? If so, perhaps:
   
   1. We do this so that it is namespaced like other Arrow-specific functions 
that don't map to R functions:
   
   ```suggestion
     register_binding_agg("arrow::arrow_one", function(...) {
   ```
   
   2. We may have to add an Rd page for it--can't remember how the docgen 
handles this.
   
   Alternatively, we could more directly create the `.data$aggregations` object 
instead of creating quosures and going through `summarise()` to find this 
definition via NSE. Then we wouldn't need to register a function here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to