thisisnic commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r783088569
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero =
FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
@rok and @AlenkaF Basically, when we're using mathematical operators[1],
because `Ops.Expression` has been defined, it means that these are
automagically turned into expressions:
https://github.com/apache/arrow/blob/9359026bad4a626de3699e023f96f0c1383d7032/r/R/expression.R#L260-L266
So the rule of thumb would be to wrap them when they're not operators,
otherwise just use them as normal.
[1] https://stat.ethz.ch/R-manual/R-devel/library/base/html/groupGeneric.html
--
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]