Extract only quarter from a date in r

后端 未结 4 1797
被撕碎了的回忆
被撕碎了的回忆 2021-01-18 08:41

I would like to extract ONLY the quarter from a date, e.g., to get an integer 1 from the date \"2003-02-08\". I have been trying something along this line

li         


        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 09:37

    dint package also is suitable for that:

    library("dint")
    d=as.Date("2015-01-01")
    get_quarter(d)
    

    you can find more about this package here.

提交回复
热议问题