I already have a partial answer to the problem here, which I understand as far as it is explained: How to most efficiently restructure a character string for fasttime in data.table
However, the task has been extended, and needs to deal with a variation of the orginal formatting.
I have a large dataset, with a column of dates of character class in the form of:
01 Jan 2014
or:
dd MMM yyyy
Which I want to restructure to feed into fastPOSIXct
which only accepts character input in POSIXct
order:
yyyy-mm-dd
The above linked question notes that an efficient approach would be to use regex and then supply the output to fast.time
. Here do I need to extend this to include a method to understand monthly abbreviations, convert to numeric, then rearrange? How would I do this? I know that there is a month.abb
as a built in constant. Should I be using this, or is there a smarter way?
What about using
lubridate
:Of course
lubridate
functions accepttz
argument too. To see a complete list of acceptable arguments seeOlsonNames()
Benchmark
I decided to update this answer with some empirical data using the
micro benchmark
package and thelubridate
option for use fasstime.