You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "DavisVaughan (via GitHub)" <gi...@apache.org> on 2023/02/27 16:32:25 UTC

[GitHub] [arrow] DavisVaughan commented on issue #34366: Don't `getFromNamespace()` the `dplyr:::check_name()` helper

DavisVaughan commented on issue #34366:
URL: https://github.com/apache/arrow/issues/34366#issuecomment-1446652168

   Since you already use both rlang and glue it looks like you can just add these two helpers to arrow itself (i.e. don't try and grab anything from dplyr's internals)
   
   ```r
   check_n_name <- function(name, 
                            vars, 
                            call = caller_env()) {
     if (is.null(name)) {
       name <- n_name(vars)
       
       if (name != "n") {
         inform(c(
           glue("Storing counts in `{name}`, as `n` already present in input"),
           i = "Use `name = \"new_name\"` to pick a new name."
         ))
       }
     } else {
       if (!is_string(name)) {
         abort("`name` must be a string or `NULL`.", call = call)
       }
     }
     
     name
   }
   
   n_name <- function(x) {
     name <- "n"
     
     while (name %in% x) {
       name <- paste0("n", name)
     }
     
     name
   }
   ```
   
   that's all I meant by inlining


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