s-news
[Top] [All Lists]

Re: timeRelative

To: David Huffer <David.Huffer@csosa.gov>
Subject: Re: timeRelative
From: Tony Plate <tplate@blackmesacapital.com>
Date: Thu, 21 Sep 2006 08:50:24 -0600
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <3C0F89000A5E6240B0B6FA31ADA6031C01EF769C@dc0633ma07.csosa.gov>
References: <3C0F89000A5E6240B0B6FA31ADA6031C01EF769C@dc0633ma07.csosa.gov>
User-agent: Mozilla Thunderbird 1.0.5 (Windows/20050711)
The example given in the docs of S-PLUS 7.0 works OK for me in S-PLUS 7.0. I suspect your problem is spaces after the '-' and "+". (My docs don't have spaces, but your examples do.)

> version
Enterprise Developer Version 7.0.6  for Microsoft Windows : 2005
> timeDate(c("1998/1/5", "1998/2/26"), format = "%a %m/%d/%Y") + timeRelative("-a0mth -1fri +3fri")
[1] Fri 1/16/1998 Fri 2/20/1998
> timeDate(c("1998/1/5", "1998/2/26"), format = "%a %m/%d/%Y") + timeRelative("-a0mth -1fri + 3fri")
[1] NA NA
>

-- Tony Plate

David Huffer wrote:
In the S-PLUS 6 for Windows Guide to Statistics, Volume 2 July
(2001), page 186, the following code is given:

  > rt <- timeRelative("-a0mth - 1fri + 3fri")
  > timeDate(c("1/5/1998", "2/26/1998"),
  + format = "%a %m/%d/%Y") + rt
  [1] Fri 1/16/1998 Fri 2/20/1998

I have not been able to reproduce this, using S-PLUS 6.2 for Windows, build 6713:

  > rt <- timeRelative("-a0mth - 1fri + 3fri")
  > rt
  [1] "-a0mth - 1fri + 3fri"
  > timeDate(c("1/5/1998", "2/26/1998"), format = "%a %m/%d/%Y") + rt
  [1] NA NA
  >

Is there a library or option i need to load or set?

--
Thanks!
David
-----------------------------------------------------
David Huffer, Senior Statistician
Court Services and Offender Supervision Agency
633 Indiana Avenue, NW, Suite 1374 Washington, DC 20004-2902 Voice: W(202) 220-5701 M(240) 426-3474 Fax: W(202) 220-5413 H(810) 963-2560
Email: david.huffer@csosa.gov
-----------------------------------------------------
--------------------------------------------------------------------
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>