Gupta, Pankaj* wrote:
Dear users,
I have a question about manipulating time-date data. Specifically, I
have two columns (class factor), each containing dates which constitute
the levels. e.g. an entry in the columns looks like "12AUG2000". I wish
to calculate the time interval by taking difference between the
respective rows in the two columns. However, when I try to use
"timeDate" for each of the columns (to convert to a Splus date format)
it gives me an error.
I have tried using timeDate as follows:
timeDate(as.character(column),in.format="%d%b%Y",format="%2m%2d%4Y")
I would appreciate any help/suggestions in this regard.
Pankaj Gupta
From ?class.timeDate under INPUT FORMATS:
<quote>
%m
input month, as integer or as alpha string. If an alpha string, case
does not matter, and any substring of a month in
options("time.month.name") that distinguishes it from the other months
will be accepted.
</quote>
So, what you want is:
timeDate("12AUG2000", in.format = "%d%m%Y", format = "%2m%2d%4Y")
--sundar
|