Re: [R] as>date parsing

2010-03-08 Thread ManInMoon
Thanks Gabor - sprintf did the trick -- View this message in context: http://n4.nabble.com/as-date-parsing-tp1582868p1584218.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

Re: [R] as>date parsing

2010-03-06 Thread Gabor Grothendieck
Try this. sprintf formats it with a leading 0 if necessary and then as.Date processes that: as.Date(sprintf("%06d", c(280210, 10210)), "%d%m%y") Note Feb only has 28 days this year so I changed the example. On Sat, Mar 6, 2010 at 10:17 AM, ManInMoon wrote: > > I have text date colum with dates

Re: [R] as>date parsing

2010-03-06 Thread Sarah Goslee
There are lots of ways to deal with text. One possibility would be to check the length with nchar(), and if it is 5, use paste() to add a 0 to the beginning. Granted, not elegant. Sarah On Sat, Mar 6, 2010 at 10:17 AM, ManInMoon wrote: > > I have text date colum with dates such at 290210 which I

[R] as>date parsing

2010-03-06 Thread ManInMoon
I have text date colum with dates such at 290210 which I can parse with %d%m%y but I also have date without leading zeo i.e. 10210 (Ist Feb 2010) which cause any NA. How can I parse the second one? -- View this message in context: http://n4.nabble.com/as-date-parsing-tp1582868p1582868.html Sent