Thank you all for your help.I came to this conclusion that data needs to be verified by its source. Thanks again.
On Thursday, July 30, 2015 7:07 AM, John Kane <jrkrid...@inbox.com> wrote: That's what I get for reading without a cup of tea beside me. I looked at 5 and my eye just slide over the last entries. I change my assessment : this looks bad. (Tea at hand). So, presumably Farnoosh may not be able to guarantee the formats for 3 & 4 either unless they are unambiguously dated. John Kane Kingston ON Canada > -----Original Message----- > From: sarah.gos...@gmail.com > Sent: Thu, 30 Jul 2015 09:19:55 -0400 > To: jrkrid...@inbox.com > Subject: Re: [R] Mixed Date Formats > > On Thu, Jul 30, 2015 at 9:14 AM, John Kane <jrkrid...@inbox.com> wrote: >> This does not look good. But not too bad >> >> Can we assume that the original data is in D-M-Y in all cases. The >> values at 3 & 4 in the sample data are ambigous, in that someone may be >> using the American dating system of M-D-Y. Given the rest of the data >> it seems unlikely but possible. > > Take a look at 5 and 7: >> 5 1375 31/12/2011 # dd/mm/yyyy >> 7 3423 01/22/2011 # mm/dd/yyyy > > They're unambiguously different. > >> Otherwise it looks possible, but probably not for me since I'm lousy at >> things like grep, to sort the data set into three parts based on the >> last three characters in the Year part of the date, convert and >> recombine. > > It would be easy if month and day were consistent, regardless of year > format. > > >> SampleData >> id value date >> 1 5813 19-Dec-11 >> 2 8706 07-Dec-11 >> 3 4049 06/05/11 >> 4 5877 05/12/11 >> 5 1375 31/12/2011 >> 6 2223 10/19/2011 >> 7 3423 01/22/2011 >> >> John Kane >> Kingston ON Canada >> >> >>> -----Original Message----- >>> From: r-help@r-project.org >>> Sent: Wed, 29 Jul 2015 21:15:45 +0000 (UTC) >>> To: sarah.gos...@gmail.com >>> Subject: Re: [R] Mixed Date Formats >>> >>> Hi Sarah, >>> Thanks for getting back to me.Here is an example of my data:SampleData >>> <- >>> structure(list(id = 1:7, value = c(5813L, 8706L, 4049L, 5877L, >>> 1375L, 2223L, 3423L), date = structure(c(4L, 3L, 2L, 1L, 7L, >>> 6L, 5L), .Label = c("05/12/11", "06/05/11", "07-Dec-11", >>> "19-Dec-11", "01/22/2011", "10/19/2011", "31/12/2011" >>> ), class = "factor")), .Names = c("id", "value", "date"), row.names = >>> c(NA, >>> -7L), class = "data.frame")SampleData >>> Thanks for your help:). >>> >>> >>> >>> >>> On Wednesday, July 29, 2015 1:50 PM, Sarah Goslee >>> <sarah.gos...@gmail.com> wrote: >>> >>> >>> On Wed, Jul 29, 2015 at 2:45 PM, farnoosh sheikhi via R-help >>> <r-help@r-project.org> wrote: >>>> Hi Arun, >>>> Hope all is well with you. I have a data with a column for date.The >>>> date >>>> format is mixed. There are date values with Month/Day/Year format and >>>> values with Day/Month/Year format.I don't know how to unify it.I >>>> really >>>> appreciate your help.Thanks. >>> >>> You sent this to the R-help list, not just to Arun, so I'm assuming >>> this is an R question. The best way to get help is to provide a sample >>> of your data using dput() and to clearly specify what you would like >>> as the result - "unify" is a bit vague. paste(x, collapse="") could be >>> considered unification, after all. >>> >>> Sarah >>> >>> -- >>> Sarah Goslee >>> http://www.functionaldiversity.org >>> >>> >> > > > > -- > Sarah Goslee > http://www.functionaldiversity.org ____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! [[elided Yahoo spam]] [[alternative HTML version deleted]] ______________________________________________ R-help@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.