5

I'm moving from SAS to R, and heavily use both INTCK and INTNX.

Are there any functions or packages that have similar functionality as these SAS functions?

Edit: Specifically I want to be able to compare two dates and return the amount of weeks in between them.

Thanks

  • This question is probably better suited for StackOverflow, as it is about programming not statistics. That aside, I would suggest looking into the package `lubridate`. – Cliff AB Sep 22 '15 at 17:21
  • 3
    Rather than asking for an R function equivalent to some SAS function, it sounds like you're just interested in computing the number of weeks between two dates in R. This should be your question. Many people could know the answer to your actual question without knowing anything about SAS. – Patrick Coulombe Sep 22 '15 at 17:21
  • see here: http://stackoverflow.com/questions/14454476/get-the-difference-between-dates-in-terms-of-weeks-months-quarters-and-years – vonjd Sep 22 '15 at 19:45

1 Answers1

4

There is function difftime. Which is used as, considering dt1 and dt2 two values representing time :

difftime(dt1, dt2, units = "weeks")

and gives you the difference of dt1 to dt2 in weeks.

Stelios K.
  • 313
  • 4
  • 14