RE: [Rd] seq.Date requires by

2004-12-03 Thread Gabor Grothendieck

Oops.  I had my own as.Date routines loaded.  (These
will be made available in the next version of zoo
but here they are in the meantime.)

If you want to get the as.Date(xD:yD) and similar
to come out you should define these:

as.Date.numeric <- function (x, ...) 
   structure(floor(x + 0.001), class = "Date")
as.Date.integer <- function (x, ...) 
   structure(x, class = "Date")

Date:   Fri, 3 Dec 2004 21:42:37 -0500 (EST) 
From:   Gabor Grothendieck <[EMAIL PROTECTED]>
To:   <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> 
Subject:   RE: [Rd] seq.Date requires by 

 


Don't know the answer to your question but note
that chron can do it without by=.

xD <- as.Date("1996-01-01")
yD <- as.Date("1996-12-01")
library(chron)
xc <- chron(xD)
yc <- chron(yD)

seq(xc, yc)

# Also one can do this in either chron or Date:

chron(xc:yc)
as.Date(xD:yD)



Date: Fri, 3 Dec 2004 11:29:08 -0800 
From: Vadim Ogranovich <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]> 
Subject: [Rd] seq.Date requires by 


Hi,

What is the reason for seq.Date to require the 'by' argument and not to
default it to 1 in the example below?


> seq(from=as.Date("1996-01-01"), to=as.Date("1996-12-01"))
Error in seq.Date(from = as.Date("1996-01-01"), to =
as.Date("1996-12-01")) : 
exactly two of `to', `by' and `length.out' / `along.with' must be
specified

This is R-1.9.1, but I haven't seen anything pertaining in the release
notes of 2.0.x.

Thanks,
Vadim

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


RE: [Rd] seq.Date requires by

2004-12-03 Thread Gabor Grothendieck


Don't know the answer to your question but note
that chron can do it without by=.

xD <- as.Date("1996-01-01")
yD <- as.Date("1996-12-01")
library(chron)
xc <- chron(xD)
yc <- chron(yD)

seq(xc, yc)

# Also one can do this in either chron or Date:

chron(xc:yc)
as.Date(xD:yD)



Date:   Fri, 3 Dec 2004 11:29:08 -0800 
From:   Vadim Ogranovich <[EMAIL PROTECTED]>
To:   <[EMAIL PROTECTED]> 
Subject:   [Rd] seq.Date requires by 

 
Hi,

What is the reason for seq.Date to require the 'by' argument and not to
default it to 1 in the example below?


> seq(from=as.Date("1996-01-01"), to=as.Date("1996-12-01"))
Error in seq.Date(from = as.Date("1996-01-01"), to =
as.Date("1996-12-01")) : 
exactly two of `to', `by' and `length.out' / `along.with' must be
specified

This is R-1.9.1, but I haven't seen anything pertaining in the release
notes of 2.0.x.

Thanks,
Vadim

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


RE: [Rd] seq.Date requires by

2004-12-03 Thread Vadim Ogranovich
This is not too convincing. The following works:
> seq(from=as.Date("1996-01-01"), to=as.Date("1996-12-01"), by=1)
so how does the system know that 1 is one day? 

Thanks,
Vadim

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Paul Roebuck
> Sent: Friday, December 03, 2004 2:17 PM
> To: R Devel Mailing List
> Subject: Re: [Rd] seq.Date requires by
> 
> On Fri, 3 Dec 2004, Vadim Ogranovich wrote:
> 
> > What is the reason for seq.Date to require the 'by' 
> argument and not 
> > to default it to 1 in the example below?
> >
> >
> > > seq(from=as.Date("1996-01-01"), to=as.Date("1996-12-01"))
> > Error in seq.Date(from = as.Date("1996-01-01"), to =
> > as.Date("1996-12-01")) :
> >  exactly two of `to', `by' and `length.out' / `along.with' must be 
> > specified
> >
> 
> >From a programming aspect, default to 1 what? day? hour?
> minute? second? microsecond? How would it determine what unit 
> you desired from the [pre]converted value it received as an argument?
> 
> --
> SIGSIG -- signature too long (core dumped)
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] seq.Date requires by

2004-12-03 Thread Paul Roebuck
On Fri, 3 Dec 2004, Vadim Ogranovich wrote:

> What is the reason for seq.Date to require the 'by' argument and not to
> default it to 1 in the example below?
>
>
> > seq(from=as.Date("1996-01-01"), to=as.Date("1996-12-01"))
> Error in seq.Date(from = as.Date("1996-01-01"), to =
> as.Date("1996-12-01")) :
>  exactly two of `to', `by' and `length.out' / `along.with' must be
> specified
>

>From a programming aspect, default to 1 what? day? hour?
minute? second? microsecond? How would it determine what
unit you desired from the [pre]converted value it received
as an argument?

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] seq.Date requires by

2004-12-03 Thread Vadim Ogranovich
Hi,

What is the reason for seq.Date to require the 'by' argument and not to
default it to 1 in the example below?


> seq(from=as.Date("1996-01-01"), to=as.Date("1996-12-01"))
Error in seq.Date(from = as.Date("1996-01-01"), to =
as.Date("1996-12-01")) : 
 exactly two of `to', `by' and `length.out' / `along.with' must be
specified

This is R-1.9.1, but I haven't seen anything pertaining in the release
notes of 2.0.x.

Thanks,
Vadim

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel