[R] How to convert European short dates to ISO format?
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Thu Jun 11 16:27:30 CEST 2020
>>>>> Rich Shepard
>>>>> on Thu, 11 Jun 2020 06:29:13 -0700 writes:
> On Thu, 11 Jun 2020, Martin Maechler wrote:
>> > Look at Hadley Wickham's 'tidyverse' collection as >
>> described in R for Data Science. There are date,
>> datetime, > and time functions that will do just what you
>> I strongly disagree that automatic guessing of date
>> format is a good idea:
> I think either you misunderstood what I wrote or I was not
> sufficiently explicit in my brief response. I did not mean
> to imply there was any automatic guessing
> involved. Specifying input and output formats is required.
Well, ok. Yes, then I misunderstood. I know there *are* R
packages out there which boast automatically finding the correct format.
If you are willing to specify the input format, I don't see why
one should use the huge tidyverse instead of just using the
potent enough base R functions, one of which Jeff Newmiller was
talking about (and to whom you replied saying you'd rather use
the extra functions).
> Reading Hadley's book I was impressed that one could
> specify the format of dates in the dataset and convert
> them all to the ISO-8601 format. Before learning this I'd
> use emacs regex to do the reformating I needed (or,
> sometimes, awk).
Well, as you know I use emacs even more than R (because I use R
via emacs's ESS), but I think I wouldn't use it to transform
dates or date times [well, unless such a date/datetime column
is so severely messed up that one format is not appropriate for
at least a few large chunks of these] because I'd rather try to
use completely reproducible R code from the beginning of
cleaning/reading/analysing the raw data to the end.
And for that, base R is entirely sufficient in spite of all the
advertisements of the many date/time formatting packages.
But yes, I wrote more about this about 10 weeks ago on the
R-devel list here (which also seemed to have been
rather mis-understood, for which I must mostly blame myself of course) :
In that thread, the following 'R News' article was mentioned as
good introduction in the subject from a 'base R' (+ "almost
recommended" package 'chron') point of view
which is really from here
'R News' was the predecessor of the
R Journal, https://journal.r-project.org/
I think we should leave it here, because we've been diverting
More information about the R-help