[R] Number of days in each month

Gabor Grothendieck ggrothendieck at gmail.com
Tue Aug 7 15:05:38 CEST 2007


> diff(seq(as.Date("2007-01-01"), as.Date("2021-01-01"), by = "month"))
Time differences in days
  [1] 31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 31
 [26] 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28
 [51] 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 31 28 31
 [76] 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30
[101] 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31
[126] 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30
[151] 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31


On 8/7/07, Lauri Nikkinen <lauri.nikkinen at iki.fi> wrote:
> Hi R-users,
>
>
>
> What is the best way to achieve a table which contains all days and months
> between years 2007-2020? I would like to calculate number of days in each
> month within those years (to data frame).
>
>
>
> Regards,
>
> Lauri
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list