R: How to get the Week number of the month

前端 未结 9 836
孤街浪徒
孤街浪徒 2020-11-30 04:05

I am new in R.
I want the week number of the month, which the date belongs to.

By using the following code:

>CurrentDate<-Sys.Date()
>We         


        
9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 04:57

    There is a simple way to do it with lubridate package:

    isoweek() returns the week as it would appear in the ISO 8601 system, which uses a reoccurring leap week.

    epiweek() is the US CDC version of epidemiological week. It follows same rules as isoweek() but starts on Sunday. In other parts of the world the convention is to start epidemiological weeks on Monday, which is the same as isoweek().

    Reference here

提交回复
热议问题