[R] Format ddmmYYYY in date

From: smoff <simon.frey_at_boku.ac.at>
Date: Wed, 04 May 2011 02:00:22 -0700 (PDT)

Hello everybody,

I'm quite new in using R so please do not kill me if I ask stupid questions.

My problem is that I have a table containing dates in the first column of 10 years. These dates have the format ddmmYYYY at least in the csv-file. After importing the file using read.table() R deletes the first character if it is a zero. So e.g. if it's 01012010 R displays it as 1012010. Now of course I cannot change the format of this column into date using as.date or strptime or at least I don't no how, because R wants to have all entires to be the same lenght. So it converts only entries like 10102000 to 10.10.2000 but write NA for shorter entries.
How do I solve this problem? Is there a way to tell R not to delete the first character even if it is a zero or to directly read the first column as date?

Thank you,


View this message in context: http://r.789695.n4.nabble.com/Format-ddmmYYYY-in-date-tp3494921p3494921.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 05 May 2011 - 06:25:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 05 May 2011 - 07:00:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive