dragosmg commented on a change in pull request #12707:
URL: https://github.com/apache/arrow/pull/12707#discussion_r837315593
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -300,6 +312,34 @@ register_bindings_duration <- function() {
build_expr("cast", x, options = cast_options(to_type = duration(unit =
"s")))
})
+ register_binding("decimal_date", function(date) {
+ # browser()
+ y <- build_expr("year", date)
+ # timezone <- call_binding("tz", date)
+ start <- call_binding("make_datetime", year = y, tz = "UTC")
+ end <- call_binding("make_datetime", year = y + 1L, tz = "UTC")
+ # maybe use yday here
Review comment:
I think using `difftime` might be a bit more robust since the number of
seconds (not days) from the beginning of the year would give us a more precise
decimal representation (and that is what lubridate does). This is especially
important if we need to convert a date time (something like `"2009-06-08
15:37:01"`) to a decimal date.
--
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]