Get a date from isoyear, isoweek, and wday values

Solution 1:

There is a package by @uwe called ISOweek you could try the following. The package has helper functions to deal with week of the year and weekday according to ISO 8601.

library(ISOweek)

ISOweek2date(
  sprintf(
    "%d-W%02d-%d",
    isoyear_val,
    isoweek_val,
    wday_val
  )
)

Output

[1] "2019-12-31"

Solution 2:

We may use make_yearweek from tsibble

library(tsibble)
as.Date(make_yearweek(year = isoyear_val, week = isoweek_val))
[1] "2019-12-30"

Not clear about the 'wday_val', if it meant to be the week_start

as.Date(make_yearweek(year  = isoyear_val, week = isoweek_val, 
      week_start = wday_val))
[1] "2019-12-31"