[R] changing date by +/- days

arun smartpink111 at yahoo.com
Tue Oct 30 03:46:17 CET 2012

Try this:
dat1<-structure(1243792800, class = c("POSIXct", "POSIXt"), tzone = "GMT")
#[1] "2009-05-21 18:00:00 GMT"

----- Original Message -----
From: chuck.01 <CharlieTheBrown77 at gmail.com>
To: r-help at r-project.org
Sent: Monday, October 29, 2012 8:37 PM
Subject: [R] changing date by +/- days

Let say I have a date variable like this:

structure(1243792800, class = c("POSIXct", "POSIXt"), tzone = "GMT")
[1] "2009-05-31 18:00:00 GMT"

How can I make it 10 days prior, so:
[1] "2009-05-21 18:00:00 GMT"

I'm randomly selecting dates from a list  and want a  second value a set #
of days either before or after. 

Thanks ahead of time. 

View this message in context: http://r.789695.n4.nabble.com/changing-date-by-days-tp4647803.html
Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list