Commits


Dragoș Moldovan-Grünfeld authored and Nic Crane committed 60f6caf9b19
ARROW-16516: [R] Implement ym() my() and yq() parsers The `ym()`, `my()` and `yq()` bindings will make the following possible (and identical): ``` r library(arrow, warn.conflicts = FALSE) library(dplyr, warn.conflicts = FALSE) library(lubridate, warn.conflicts = FALSE) test_df <- tibble::tibble( ym_string = c("2022-05", "2022/02", "22.03", NA) ) test_df %>% mutate(ym_date = ym(ym_string)) #> # A tibble: 4 × 2 #> ym_string ym_date #> <chr> <date> #> 1 2022-05 2022-05-01 #> 2 2022/02 2022-02-01 #> 3 22.03 2022-03-01 #> 4 <NA> NA test_df %>% arrow_table() %>% mutate(ym_date = ym(ym_string)) %>% collect() #> # A tibble: 4 × 2 #> ym_string ym_date #> <chr> <date> #> 1 2022-05 2022-05-01 #> 2 2022/02 2022-02-01 #> 3 22.03 2022-03-01 #> 4 <NA> NA ``` <sup>Created on 2022-05-16 by the [reprex package](https://reprex.tidyverse.org) (v2.0.1)</sup> I've implementing this with the following steps: * add `"-01"` to the end of the strings we're trying to parse, and then * use one the supported `orders` (`"ymd"` or `"myd"`) Closes #13163 from dragosmg/ym_my_yq_parsers Authored-by: Dragoș Moldovan-Grünfeld <dragos.mold@gmail.com> Signed-off-by: Nic Crane <thisisnic@gmail.com>