dragosmg commented on a change in pull request #12429:
URL: https://github.com/apache/arrow/pull/12429#discussion_r807300733
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -147,5 +147,14 @@ register_bindings_datetime <- function() {
register_binding("pm", function(x) {
!call_binding("am", x)
})
-
+ register_binding("semester", function(x, with_year = FALSE) {
+ month <- call_binding("month", x)
+ semester <- call_binding("if_else", month <= 6, 1L, 2L)
+ if (with_year) {
+ year <- call_binding("year", x)
+ return(year + semester / 10)
Review comment:
Yes, initially I implemented it as a string, as at least that felt like
adding a guardrail, but nope, it's numeric.
--
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]