[Rd] Proposal: Internal as.Date.POSIXct()

Joshua Ulrich jo@h@m@ulrich @ending from gm@il@com
Wed Oct 31 12:30:20 CET 2018


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



More information about the R-devel mailing list