From ed37d3a3b3eef76b696532f10562fea85f809fab Mon Sep 17 00:00:00 2001 From: Alenka Frim Date: Fri, 21 Jan 2022 09:15:31 +0100 Subject: [PATCH] Adding a binding and a test for mday() lubridate --- r/R/expression.R | 1 + r/tests/testthat/test-dplyr-funcs-datetime.R | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/r/R/expression.R b/r/R/expression.R index 37fc21c25c4..0e71803ec97 100644 --- a/r/R/expression.R +++ b/r/R/expression.R @@ -70,6 +70,7 @@ "quarter" = "quarter", # second is defined in dplyr-functions.R # wday is defined in dplyr-functions.R + "mday" = "day", "yday" = "day_of_year", "year" = "year", diff --git a/r/tests/testthat/test-dplyr-funcs-datetime.R b/r/tests/testthat/test-dplyr-funcs-datetime.R index 359a5403aca..228eca56add 100644 --- a/r/tests/testthat/test-dplyr-funcs-datetime.R +++ b/r/tests/testthat/test-dplyr-funcs-datetime.R @@ -444,6 +444,15 @@ test_that("extract wday from timestamp", { ) }) +test_that("extract mday from timestamp", { + compare_dplyr_binding( + .input %>% + mutate(x = mday(datetime)) %>% + collect(), + test_df + ) +}) + test_that("extract yday from timestamp", { compare_dplyr_binding( .input %>% @@ -626,6 +635,15 @@ test_that("extract wday from date", { ) }) +test_that("extract mday from date", { + compare_dplyr_binding( + .input %>% + mutate(x = mday(date)) %>% + collect(), + test_df + ) +}) + test_that("extract yday from date", { compare_dplyr_binding( .input %>%