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 <xmoon2000 at googlemail.com>
wrote:>
> 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 from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>