dragosmg opened a new pull request #12429:
URL: https://github.com/apache/arrow/pull/12429
Once this PR is merged the following code snippet will be valid
``` r
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(arrow))
df <- tibble(
dates = as.Date(c("2021-04-30", "2021-07-31", "2021-10-31", "2021-01-31"))
)
df %>%
record_batch() %>%
mutate(
semester_without_year = semester(dates),
semester_with_year = semester(dates, with_year = TRUE)) %>%
collect()
#> # A tibble: 4 × 3
#> dates semester_without_year semester_with_year
#> <date> <int> <dbl>
#> 1 2021-04-30 1 2021.1
#> 2 2021-07-31 2 2021.2
#> 3 2021-10-31 2 2021.2
#> 4 2021-01-31 1 2021.1
```
and identical with the `lubridate` result:
``` r
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(lubridate))
df <- tibble(
dates = as.Date(c("2021-04-30", "2021-07-31", "2021-10-31", "2021-01-31"))
)
df %>%
mutate(
semester_without_year = semester(dates),
semester_with_year = semester(dates, with_year = TRUE))
#> # A tibble: 4 × 3
#> dates semester_without_year semester_with_year
#> <date> <int> <dbl>
#> 1 2021-04-30 1 2021.1
#> 2 2021-07-31 2 2021.2
#> 3 2021-10-31 2 2021.2
#> 4 2021-01-31 1 2021.1
```
<sup>Created on 2022-02-15 by the [reprex
package](https://reprex.tidyverse.org) (v2.0.1)</sup>
--
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]