On Thu, Jun 21, 2012 at 2:48 PM, Liviu Andronic <landronim...@gmail.com> wrote: > The culprit is likely that the 'x' vector is 'character' throughout, > but I'm not sure how to work around. For example, I couldn't figure > how to create an empty 'Date' vector. Regards >
I think I managed to crack this by myself. I only needed to add an as.character() call: > x[xa] <- as.character(as.Date(x[xa], format="%d/%m/%Y")) > x[xb] <- as.character(as.Date(x[xb], format="%Y%m%d")) > x [1] "2005-03-01" "2004-04-13" "2005-05-02" "2005-05-02" "2007-05-07" "2004-04-22" [7] "2005-04-21" "2008-04-30" "2003-05-13" "2008-05-29" NA NA [13] "1999-05-19" "2000-05-17" "2000-05-17" Liviu ______________________________________________ R-help@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.