Re: [R] CSV file and date. Dates are read as factors!

2005-07-28 Thread Peter Dalgaard
Don MacQueen <[EMAIL PROTECTED]> writes: > It's really pretty simple. > > First, if you supply as.is=TRUE to read.csv() [or read.table()] then > your dates will be read as character strings, not factors. That saves > the step of converting them from factor to character. > > Then, use as.Date()

Re: [R] CSV file and date. Dates are read as factors!

2005-07-28 Thread Don MacQueen
It's really pretty simple. First, if you supply as.is=TRUE to read.csv() [or read.table()] then your dates will be read as character strings, not factors. That saves the step of converting them from factor to character. Then, use as.Date() to convert the date columns to objects of class "Date"

Re: [R] CSV file and date. Dates are read as factors!

2005-07-28 Thread Jorge de la Vega Gongora
Use the package chron. Before importing the data to R from the cvs file, convert dates to numeric format. Dates are just a sequence from a starting point. I use the following to work with dates. Asuming you have a column in your cvs file with header "date": options(chron.origin=c(month=12,day=3

Re: [R] CSV file and date. Dates are read as factors!

2005-07-28 Thread roger bos
Working with dates is not easy (for me at least). I always manage to get it done, but the code is somewhat messy. I have not tried using the Hmisc package as Frank suggested, but I will show you my code as an alternate way: w <- unclass((as.Date(as.character(dataMat$fy1_period_end_date), format=

Re: [R] CSV file and date. Dates are read as factors!

2005-07-28 Thread Frank E Harrell Jr
John Sorkin wrote: > I am using read.csv to read a CSV file (produced by saving an Excel file > as a CSV file). The columns containing dates are being read as factors. > Because of this, I can not compute follow-up time, i.e. > Followup<-postDate-preDate. I would appreciate any suggestion that woul

[R] CSV file and date. Dates are read as factors!

2005-07-27 Thread John Sorkin
I am using read.csv to read a CSV file (produced by saving an Excel file as a CSV file). The columns containing dates are being read as factors. Because of this, I can not compute follow-up time, i.e. Followup<-postDate-preDate. I would appreciate any suggestion that would help me read the dates as