2

I believe this question hasn't been answered for week dates, yet.

Suppose I have:

date1 <- '2015-W23'
date2 <- '2015-W30'

I want to compute the difference between these two dates as follows:

print(date1 - date2)
7

How can I do this? Thanks

JJurado
  • 21
  • 1

1 Answers1

2

How about using tsibble package?

library(tsibble)

yearweek('2015-W23') - yearweek('2015-W30')

Time difference of -7 weeks
Ben
  • 28,684
  • 5
  • 23
  • 45