Dear All,
I am looking for a function to get lagged dates from an input vector of
dates, whereas the lag is specified by another vector. Each date is lagged
by a different number of days. (specified in vector n)
Example:
input <- as.Date( c( "2002-01-30", "2002-02-24", "2002-03-31") )
n <- c(10, 20, 31)
Desired Result:
"2002-02-09"
"2002-03-16"
"2002-05-01"
Can anyone help me with this?
Thanks in advance,
RNoob
--
View this message in context: http://r.789695.n4.nabble.com/Lag-vector-of-dates-by-vector-of-days-tp4348530p4348530.html
Sent from the R help mailing list archive at Nabble.com.
Lag vector of dates by vector of days
3 messages · Alexander Erbse, Jorge I Velez, R. Michael Weylandt
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120201/ee41868d/attachment.pl>
input + n Michael
On Wed, Feb 1, 2012 at 11:45 AM, RNoob <ae at alpha-centauri.com> wrote:
Dear All, I am looking for a function to get lagged dates from an input vector of dates, whereas the lag is specified by another vector. Each date is lagged by a different number of days. (specified in vector n) Example: input <- ?as.Date( c( "2002-01-30", "2002-02-24", "2002-03-31") ) n ? ? ? ? <- ?c(10, 20, 31) Desired Result: "2002-02-09" "2002-03-16" "2002-05-01" Can anyone help me with this? Thanks in advance, RNoob -- View this message in context: http://r.789695.n4.nabble.com/Lag-vector-of-dates-by-vector-of-days-tp4348530p4348530.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ 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.