Get week starting date from weeknum and year in R

后端 未结 2 537
旧时难觅i
旧时难觅i 2021-01-12 21:08

I\'m looking for a function that will get year + week number + Week day, and return a date, for example:

I would like to input the 3 following

 2015         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-12 21:12

    Using strptime:

    strptime("2015Monday23", "%Y%A%U")
    # [1] "2015-06-08"
    

    Or more generally

    strptime(paste0(2015, "Monday", 23), "%Y%A%U")
    

提交回复
热议问题