paleolimbot commented on code in PR #13163:
URL: https://github.com/apache/arrow/pull/13163#discussion_r875112056
##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -514,6 +539,41 @@ register_bindings_datetime_parsers <- function() {
)
}
+ # build separate expression lists of parsing attempts for the orders that
+ # need an augmented `x`
+ # list for attempts when orders %in% c("ym", "my")
+ parse_attempt_exp_augmented_x <- list()
+
+ if (!is.null(augmented_x)) {
+ for (i in seq_along(formats)) {
+ parse_attempt_expressions[[i]] <- build_expr(
+ "strptime",
+ augmented_x,
+ options = list(format = formats[[i]], unit = 0L, error_is_null =
TRUE)
+ )
+ }
+ }
+
+ # list for attempts when orders %in% c("yq")
+ parse_attempt_exp_augmented_x2 <- list()
+
+ if (!is.null(augmented_x2)) {
+ for (i in seq_along(formats)) {
Review Comment:
See above...I think you probably want `lapply(seq_along)` or `imap()` to
make this consistent with how we do this elsewhere.
##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -514,6 +539,41 @@ register_bindings_datetime_parsers <- function() {
)
}
+ # build separate expression lists of parsing attempts for the orders that
+ # need an augmented `x`
+ # list for attempts when orders %in% c("ym", "my")
+ parse_attempt_exp_augmented_x <- list()
+
+ if (!is.null(augmented_x)) {
+ for (i in seq_along(formats)) {
Review Comment:
We rarely use this pattern elsewhere in the package...if you need both the
index and the value you could use `imap()` since we import most of purrr.
--
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]