1

I'm relatively new to R and I'm sure this is easy.

I have a column with dates and I want to create a new column, and fill it with a date that is two days prior to the date given. Is there an easy and quick way to do this? Some package that will make this happen. Example data frame below. df1 is the original data frame. df2 is what I'm hoping to achieve.

df1

ID    Date1
11    2009-12-01
12    2009-11-05
13    2009-12-05
14    2009-12-07


df2

ID    Date1         Date2
11    2009-12-01    2009-11-29
12    2009-11-05    2009-11-03
13    2009-12-05    2009-12-03
14    2009-12-07    2009-12-05

Thanks!

Tham v
  • 51
  • 4

0 Answers0