etiennebacher opened a new pull request, #46667: URL: https://github.com/apache/arrow/pull/46667
### Rationale for this change When a script is called in an environment that isn't the global environment (for instance with `source("my-script.R", local = new.env())`, `case_when()` would fail to detect external objects used in conditions. This PR fixes this behavior. Fixes #46636 ### What changes are included in this PR? When evaluating expressions in `dplyr` functions, `eval_tidy()` now takes into account `mask` as an environment where it should look for external objects. @thisisnic suggested in #46636 that the bug might be due to https://github.com/apache/arrow/blob/main/r/R/dplyr-funcs-conditional.R#L116 but I couldn't find a way to fix it there. ### Are these changes tested? I added a test for this scenario. I ensured it failed before the change and succeeds after. ### Are there any user-facing changes? There is one user-facing, non-breaking change, illustrated both in the related issue and in the new test. -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org