I have the below dataset
Week Year
1 2019
2 2019
1 2020
2 2020
I wish to add a column that shows the start date of the week (starting on Sunday)
So, my ideal output would be
Week Year Date
1 2019 06/01/2019
2 2019 13/01/2019
1 2020 05/01/2020
2 2020 12/01/2010
I have tried the below solution
library (lubridate)
if (df$Year ==2019) {df$Date = parse_date_time(paste(2019, df$Week, 'Sun', sep=" "),'Y/W/a')}
if (df$Year ==2019) {df$Date = parse_date_time(paste(2020, df$Week, 'Sun', sep=" "),'Y/W/a')}
However, I got the warning message that "failed to parse". Any tips would be appreciated