Displaying 1 result from an estimated 1 matches for "xdate2".
Did you mean:
date2
2009 Mar 25
1
Creating date seq in data frame
...:
myData <- data.frame(x = 1:5, y = letters[1:5], xDate =
seq(as.Date("2001/2/1"), as.Date("2005/2/1"), by="year") )
> myData
x y xDate
1 a 2001-02-01
2 b 2002-02-01
3 c 2003-02-01
4 d 2004-02-01
5 e 2005-02-01
What I need is a new column, say xDate2, that for each xDate (or for each
unique combination of x,y, and xDate), I will have few days before and few
days after, as follow:
myData
x y xDate xDate2
1 a 2001-02-01 2001-01-30
1 a 2001-02-01 2001-01-31
*1 a 2001-02-01 2001-02-01* (original row)
1 a 2001-02-01 2001-02-02
1...