nikostr opened a new issue, #41959:
URL: https://github.com/apache/arrow/issues/41959

   ### Describe the enhancement requested
   
   I'm interested in finding the number of non-zero columns for every row in my 
table. I'm currently doing something like this:
   
   ```
   f <- function(x) x==0
   g <- function(...) Reduce(`+`, list(...))
   
   sample_names <- paste0('sample', 1:3)
     
   open_delim_dataset(
     'test.txt',
     col_names = c('kmer', sample_names),
     delim = ' ',
   ) %>%
     mutate(
       across(-kmer, f, .names='bool_{.col}'),
       n_zero = g(!!!syms(paste0('bool_',sample_names)))
     ) 
   ```
   
   which gives the error `Function 'add_checked' has no kernel matching input 
types (bool, bool)`. I've tried `cast`ing across the columns but I haven't 
managed to change them from bools to ints. I've also tried using 
`rowSums(across(starts_with('bool')))` instead of the `Reduce`, but apparently 
that isn't supported either. What is the recommended way of doing this?
   
   ### Component(s)
   
   R


-- 
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