thisisnic commented on code in PR #12757:
URL: https://github.com/apache/arrow/pull/12757#discussion_r848484497


##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -330,3 +349,33 @@ binding_format_datetime <- function(x, format = "", tz = 
"", usetz = FALSE) {
 
   build_expr("strftime", x, options = list(format = format, locale = 
Sys.getlocale("LC_TIME")))
 }
+
+duration_from_chunks <- function(chunks) {
+  accepted_chunks <- c("second", "minute", "hour", "day", "week")
+  matched_chunks <- accepted_chunks[pmatch(names(chunks), accepted_chunks, 
duplicates.ok = TRUE)]
+
+  if (any(is.na(matched_chunks))) {
+    abort(
+      paste0(
+        "Invalid `difftime` parts: ",

Review Comment:
   Yes please - I think that while the tidyverse generally serves as a model of 
great error messages, even [the tidyverse style 
guide](https://style.tidyverse.org/error-messages.html) admits that some could 
be better, and if there's no harm in improving them we should.  I see your 
point about replication though; how about keeping the message you've got there 
as the second sentence of the error message and just adding in an extra 
sentence at the start?



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

Reply via email to