You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2023/07/19 14:49:47 UTC
[GitHub] [arrow] paleolimbot commented on a diff in pull request #36758: GH-36720: [R] stringr modifier functions cannot be called with namespace prefix
paleolimbot commented on code in PR #36758:
URL: https://github.com/apache/arrow/pull/36758#discussion_r1268184251
##########
r/R/dplyr-funcs-string.R:
##########
@@ -56,15 +56,33 @@ get_stringr_pattern_options <- function(pattern) {
)
}
}
+
ensure_opts <- function(opts) {
if (is.character(opts)) {
opts <- list(pattern = opts, fixed = FALSE, ignore_case = FALSE)
}
opts
}
+
+ pattern <- clean_pattern_namespace(pattern)
+
ensure_opts(eval(pattern))
}
+# Ensure that e.g. stringr::regex and regex both work within patterns
+clean_pattern_namespace <- function(pattern) {
+ if (is_call(pattern)) {
Review Comment:
```suggestion
modifier_funcs <- c("fixed", "regex", "coll", "boundary")
if (is_call(pattern, modifier_funcs, ns = c("", "stringr")) {
```
...might work too?
--
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