s-news
[Top] [All Lists]

Re: timeDate

To: Laura Chihara <lchihara@carleton.edu>
Subject: Re: timeDate
From: David L Lorenz <lorenz@usgs.gov>
Date: Fri, 27 Oct 2006 07:58:00 -0500
Cc: s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu
In-reply-to: <4540FBF0.6040108@carleton.edu>

Laura,
  TimeDate objects store the date and the integer number of days since 1/1/1960 and time as the integer number of milliseconds since midnight. So there really are two parts to your question.
  The first (truncating the data) is important if you wanted to merge observations based on the day or table the occurrences on each day. To really truncate the data, you can use the trunc() function.
  The second is for presentation. To change how dates are displayed, you need to change the format slot. For example, if you had a vector of timeDate data called Junk, then to see only the month/day/year:

Junk@format <- "%m/%d/%Y"

  There are several functions that extract information from timeDate data. The months() function will create a factor vector of the months.
Dave



Laura Chihara <lchihara@carleton.edu>
Sent by: s-news-owner@lists.biostat.wustl.edu

10/26/2006 01:18 PM

To
s-news@lists.biostat.wustl.edu
cc
Subject
[S] timeDate






How do you truncate the time portion from
a timeDate object.For example, for observations of
times such as 3/20/2006 10:21:50.000
I just want the date 3/20/2006
I want to use table to count the number of occurrences
of 3/20/2006, 3/21/2006, etc.

More generally, how do you extract other parts of the
date - say I want a variable that just keeps
the months (I want to see how many times
March occurs, April occurs, etc.)

Thanks!

-- Laura Chihara

*******************************************
Laura Chihara
Associate Professor    507-646-4065 (office)
Dept of Mathematics    507-646-4312 (fax)
Carleton College
1 North College Street
Northfield MN 55057
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • timeDate, Laura Chihara
    • Re: timeDate, David L Lorenz <=