-2

I have a data frame "Invoice" which look like this:

Invoice_ID    Invoice_DATE   Nr_of_days_until_deadline
  101           1/20/2017         7
  102           1/25/2017         4
  103           1/29/2017         5
  104           2/01/2017         4
  105           2/05/2017         3

I have to populate the data frame Deadline_Invoces by writing R modules for determining the deadline DATE for each invoice, where deadline_DATE = Invoice_DATE + Nr_of_days_until_deadline.

Thus I have to obtain data frame Deadline_Invoces:

    Invoice_ID  Invoice_DATE    Deadline_DATE

How should I sum DATE with a NUMBER and to obtain a DATE?

Thank you in advance!!!

1 Answers1

-1

make sure you have your date column formatted as a date...then make a new column, call it Deadline or something like that. From there: Invoice$Deadline <- as.Date(Invoice$Invoice_DATE) + Invoice$Nr_of_days_until_deadline

Check out the lubridate package in R

nate
  • 1,172
  • 1
  • 11
  • 26