Re: [R] days between dates

From: Geoffrey Smith <>
Date: Mon, 23 May 2011 10:30:05 -0700

Thank you for the email. The data is unbalanced, meaning that some days are missing. So the sequence of days could be something like Tuesday, Wednesday, Friday, Monday. The diff function would produce 1, 2, 3. But I would like it to produce 1, 2, 1 since there is really only 1 day between Friday and Monday. Thank you. Geoff

On Mon, May 23, 2011 at 10:09 AM, Jeff Newmiller <>wrote:

> Your request seems bizarre to me. If you really want to ignore the actual
> time intervals, just do your analysis without the actual dates.
> If you just want forward-looking time intervals, then put them in the
> correct index locations.
> ?diff
> c(diff(DF$DATE),1)
> ---------------------------------------------------------------------------
> Jeff Newmiller The ..... ..... Go Live...
> DCN:<> Basics: ##.#. ##.#. Live Go...
> Live: OO#.. Dead: OO#.. Playing
> Research Engineer (Solar/Batteries O.O#. #.O#. with
> /Software/Embedded Controllers) .OO#. .OO#. rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 23 May 2011 - 17:39:38 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Tue 24 May 2011 - 04:40:09 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive