You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/10 15:03:47 UTC

[GitHub] [arrow] nealrichardson commented on a diff in pull request #14281: ARROW-17387: [R] Implement dplyr::across() inside filter()

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


##########
r/R/dplyr-across.R:
##########
@@ -58,9 +58,38 @@ expand_across <- function(.data, quos_in) {
     } else {
       quos_out <- append(quos_out, quo_in)
     }
+
+    if (is_call(quo_expr, "if_any")) {
+      quos_out <- append(list(), purrr::reduce(quos_out, combine_if, op = "|", envir = quo_get_env(quos_out[[1]])))
+    }
+
+    if (is_call(quo_expr, "if_all")) {
+      quos_out <- append(list(), purrr::reduce(quos_out, combine_if, op = "&", envir = quo_get_env(quos_out[[1]])))
+    }
   }
 
-  quos_out
+  new_quosures(quos_out)
+}
+
+# takes multiple expressions and combines them with & or |
+combine_if <- function(lhs, rhs, op, envir) {
+  expr_text <- paste(
+    expr_text(quo_get_expr(lhs)),
+    expr_text(quo_get_expr(rhs)),
+    sep = paste0(" ", op, " ")
+  )
+
+  expr <- parse_expr(expr_text)
+
+  new_quosure(expr, envir)
+}
+
+if_any <- function(.cols = everything(), .fns = NULL, ..., .names = NULL) {
+
+}
+
+if_all <- function(.cols = everything(), .fns = NULL, ..., .names = NULL) {
+

Review Comment:
   These aren't needed right?
   
   ```suggestion
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org