GitHub user HyukjinKwon opened a pull request:
https://github.com/apache/spark/pull/20031
[SPARK-22844][R] Adds date_trunc in R API
## What changes were proposed in this pull request?
This PR adds `date_trunc` in R API as below:
```r
> df <- createDataFrame(list(list(a = as.POSIXlt("2012-12-13 12:34:00"))))
> head(select(df, date_trunc("hour", df$a)))
date_trunc(hour, a)
1 2012-12-13 12:00:00
```
## How was this patch tested?
Unit tests added in `R/pkg/tests/fulltests/test_sparkSQL.R`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/HyukjinKwon/spark r-datetrunc
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/20031.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #20031
----
commit c54abe9dfad3dd7447209807826e79b1682f028c
Author: hyukjinkwon <gurwls223@...>
Date: 2017-12-20T09:53:53Z
Adds date_trunc in R API
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]