[R] Mixed format

Val v@|kremk @end|ng |rom gm@||@com
Mon Jan 20 23:58:39 CET 2020

Hi All,

I have a data frame where one column is  a mixed date format,
a date in the form "%m-%d-%y"  and "%m/%d/%Y", also some are not in date format.

Is there a way to delete the rows that contain non-dates  and
standardize the dates in one date format like  %m-%d-%Y?
Please see my  sample data and desired output

DFX<-read.table(text="name ddate
  A  19-10-02
  B  22-11-20
  C  19-01-15
  D  11/19/2006
  F  9/9/2011
  G  12/29/2010
  H  DEX",header=TRUE)

Desired output
name ddate
A  19-10-2002
B  22-11-2020
C  19-01-2015
D  11-19-2006
F  09-09-2011
G  12-29-2010

Thank you

More information about the R-help mailing list