-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
3 changed files
with
137 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters