"Kerpel, John" <[EMAIL PROTECTED]> writes: > Hi Folks! > > > > I'm reading in some data from a .csv file that has a date column. > > > > How do I use colClasses to get read.csv to recognize the date column? > The documentation on this seems to be nil - > > And yes, I've read help and R Data Import/Export and can't figure out > what the colClasses syntax is.
1. It may be easier just to read the date field as factor or character and convert using as.Date afterwards. If a format is needed, this is actually the only way. 2. colClasses is a character vector, possibly named, so cls <- rep(NA,17) cls[3] <- "Date" read.csv(...., colClasses=cls, ....) or read.csv(...., colClasses=c(mydate="Date"), ....) should work (assuming that the variable in question is called "mydate" and is in the 3 of 17 columns). This is documented in ?read.csv. -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html