Try this also:
x <- seq(as.Date("2008-01-01"), as.Date("2008-12-31"), l = 10)
as.Date(embed(matrix(x), 2)[,1], origin = "1970-01-01")
On Wed, Jan 21, 2009 at 7:18 PM, Alina Sheyman wrote:
> I am working with a list of dates and I would like to replace each date
> with
> the one that comes after
rom: Alina Sheyman
To: r-help@r-project.org
Sent: Thursday, January 22, 2009 2:48:42 AM
Subject: [R] Replacing dates with consecutive observations
I am working with a list of dates and I would like to replace each date with
the one that comes after, ie. 1/1/07 will become 1/5/07, 1/5/07 will become
1
I am working with a list of dates and I would like to replace each date with
the one that comes after, ie. 1/1/07 will become 1/5/07, 1/5/07 will become
1/7/07, etc. The number of days between my dates always varies, so I can't
just increase each one by 5 days or so. Does anyone know of a way I ca
3 matches
Mail list logo