How do I convert date to number of days in R

后端 未结 7 1653
囚心锁ツ
囚心锁ツ 2021-01-04 14:19

How do I convert date to number of days, starting from the first day of the year.

How do I convert the following to the expected result below?

   Dat         


        
7条回答
  •  悲哀的现实
    2021-01-04 14:58

    You can also use this solution to get the number of the days :

    mydates <- as.Date(c("2007-06-22", "2004-02-13")) days <- mydates[1] - mydates[2] days <- as.numeric(days) [1] 1225

提交回复
热议问题