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