Re: [R] Date Time Sequence

From: stephen sefick <ssefick_at_gmail.com>
Date: Thu, 26 Jun 2008 18:16:23 -0400

Gabor this is better than using

x = seq(ISOdate(2006,1,1, 0, 0, 0), by = "15 min", length.out=35040)

this works but your code below is exactly what I needed instead of almost. thankyou very much

Stephen

On Thu, Jun 26, 2008 at 6:06 PM, Gabor Grothendieck <ggrothendieck_at_gmail.com> wrote:

> Try this:
>
> library(chron)
> t1 <- chron("1/1/2006", "00:00:00")
> t2 <- chron("12/31/2006", "23:45:00")
> deltat <- times("00:15:00")
> tt <- seq(t1, t2, by = times("00:15:00"))
>
> Note that if you have some data and your intention is simply to
> create the index for it so you can create a zoo or zooreg object
> then the zooreg constructor can do it for you. For example,
> a series of 10 values starting at t1 with successive points
> spaced 15 minutes apart is:
>
> library(zoo)
> zooreg(1:10, start = t1, deltat = as.numeric(deltat))
>
> On Thu, Jun 26, 2008 at 5:36 PM, stephen sefick <ssefick_at_gmail.com> wrote:
> > I would like a sequence of dates with a time step of 15 minutes
> > starting:
> > 1/1/2006 00:00:00 - 12/31/2006 23:45:00
> >
> > function(x) {
> > chron(sub(" .*", "", x), gsub(".* (.*)", "\\1:00", x))
> > }
> >
> > this is the piece of code I use to read in zoo objects
> > for any help I would be grateful I have tried sequence and I can not
> seem
> > to get it to work
> >
> > --
> > Let's not spend our time and resources thinking about things that are so
> > little or so large that all they really do for us is puff us up and make
> us
> > feel like gods. We are mammals, and have not exhausted the annoying
> little
> > problems of being mammals.
> >
> > -K. Mullis
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 26 Jun 2008 - 22:23:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 26 Jun 2008 - 22:31:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive