Nicola Crane created ARROW-17948:
------------------------------------

             Summary: [R] arrow_eval user-defined generic functions  
                 Key: ARROW-17948
                 URL: https://issues.apache.org/jira/browse/ARROW-17948
             Project: Apache Arrow
          Issue Type: Improvement
          Components: R
            Reporter: Nicola Crane


ARROW-14071 covers evaluating user-defined functions, but once this is 
implemented, would it be possible to evaluate generics?  Here's an example of 
how that works in dplyr from a [Stack Overflow 
question|https://stackoverflow.com/questions/73950714/is-it-possible-to-use-generics-in-apache-arrow]:


{code:r}
library(dplyr)

df <- data.frame(a = c("these", "are", "some", "strings"),
                 b = 1:4)

boop <- function(x, ...) UseMethod("boop", x)

boop.numeric <- function(x) mean(x, na.rm = TRUE)

boop.character <- function(x) mean(nchar(x), na.rm =TRUE )

df %>% summarise(across(everything(), boop))
{code}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to