[R] Format

Eric Berger er|cjberger @end|ng |rom gm@||@com
Mon Jun 10 10:02:25 CEST 2024


Since you are loading lubridate it is enough to do

Atest$ddate1 <- dmy(Atest$ddate)



On Sun, Jun 9, 2024 at 11:59 PM Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>
> On 2024-06-09 4:39 p.m., Val wrote:
> > HI all,
> >
> > My
> > I am trying to convert character date (mm/dd/yy)  to YYYY-mm-dd date
> > format in one of the columns of my data file.
> >
> > The first few lines of the data file looks like as follow
> >
> >   head(Atest,10);dim(Atest)
> >        ddate
> > 1  19/08/21
> > 2  30/04/18
>
> Those aren't legal months in the first entry.  Your format looks like it
> should be "%d/%m/%y".
>
> Duncan Murdoch
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list