On Mon, 11 Oct 2004, bogdan romocea wrote: > Dear R users, > > I have a column with dates (character) in a data frame: > 12-Jan-01 11-Jan-01 10-Jan-01 9-Jan-01 8-Jan-01 5-Jan-01 > and I need to convert them to (Julian) dates so that I can > sort the whole data frame by date. I thought it would be > very simple, but after checking the documentation and the > list I still don't have something that works. > > 1. as.Date returns the error below. What am I doing wrong? > As far as I can see the character strings are in standard > format. > d$Date <- as.Date(d$Date, format="%d-%b-%y") > Error in fromchar(x) : character string is not in a > standard unambiguous format
I get: > x <- scan(what="") 1: 12-Jan-01 11-Jan-01 10-Jan-01 9-Jan-01 8-Jan-01 5-Jan-01 7: Read 6 items > as.Date(x, format="%d-%b-%y") [1] "2001-01-12" "2001-01-11" "2001-01-10" "2001-01-09" "2001-01-08" [6] "2001-01-05" Are you in an English-speaking domain? Try running in the C locale (?Sys.setlocale). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
