s-news
[Top] [All Lists]

Re: timeDate use

To: "Gupta, Pankaj*" <GuptaP@cder.fda.gov>
Subject: Re: timeDate use
From: Sundar Dorai-Raj <sundar.dorai-raj@PDF.COM>
Date: Tue, 24 Aug 2004 17:23:51 -0700
Cc: "'s-news@lists.biostat.wustl.edu'" <s-news@lists.biostat.wustl.edu>
In-reply-to: <E4C7D6B482D9844FB259B476390E39250A8EF0F5@cdsx05.cder.fda.gov>
Organization: PDF Solutions, Inc.
References: <E4C7D6B482D9844FB259B476390E39250A8EF0F5@cdsx05.cder.fda.gov>
Reply-to: sundar.dorai-raj@PDF.COM
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)


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



<Prev in Thread] Current Thread [Next in Thread>
  • timeDate use, Gupta, Pankaj*
    • Re: timeDate use, Sundar Dorai-Raj <=