R: How to get the Week number of the month

前端 未结 9 852
孤街浪徒
孤街浪徒 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 05:00

    I don't know R but if you take the week of the first day in the month you could use it to get the week in the month

    2014-09-18
    First day of month = 2014-09-01
    Week of first day on month = 36
    Week of 2014-09-18 = 38
    Week in the month = 1 + (38 - 36) = 3
    

提交回复
热议问题