Proposal: Internal as.Date.POSIXct()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Proposal: Internal as.Date.POSIXct()

Joshua Ulrich
I would like to propose a .Internal() POSIXct2Date() function, similar
to do_POSIXlt2D() in src/main/datetime.c.  I created a working
prototype, which is now included in Dirk Eddelbuettel's RApiDatetime
package:

https://github.com/eddelbuettel/rapidatetime

This prototype is a combination of asPOSIXlt and POSIXlt2D from R
Core.  The functions are essentially concatenated, with the extraneous
parts removed.  Directly converting from POSIXct to Date uses less
memory and is roughly twice as fast.

You can find the relevant bits in the commit on GitHub:
https://github.com/eddelbuettel/rapidatetime/commit/6bc9320451fb1e62d53b5012d33acf538c0f50c6#diff-7df5c1a674e930a4d93ba45f3ce0aaaf

Would someone on R Core be interested in adding this function?  If so,
I can create a patch that includes all the necessary code additions
needed to make it a .Internal() function.

Thanks for your consideration!

Best,
Josh

--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel