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()
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"
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
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=
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
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