小编B.C*_*ali的帖子

Convert week.year to year.month - date in R

I would like to convert a date week.year ("44.2016") to year.month (2016-11) in ISO 8601

I have a variable date_week <- "44.2016"

I tried this :

as.Date(date_week, format = "%U.%Y")

as.Date(date_week, format = "%W.%Y")
Run Code Online (Sandbox Code Playgroud)

I have this result: "2016-02-21"

I also tried this :

as.Date(date_week, format = "%w.%Y")

as.Date(date_week, format = "%w.%Y")
Run Code Online (Sandbox Code Playgroud)

result : NA

I would like to have this RESULT : "2016-11"

Thanks for your help !

r date

2
推荐指数
1
解决办法
294
查看次数

标签 统计

date ×1

r ×1