[R] Count days of current year

hadley wickham h.wickham at gmail.com
Tue Nov 25 15:38:54 CET 2008


Why not write it yourself?

days_in_year <- function(year) {
  365 + (year %% 4 == 0) - (year %% 100 == 0) + (year %% 400 == 0)
}

This should work for any year in the Gregorian calendar.

Hadley

On Mon, Nov 24, 2008 at 1:25 PM, Felipe Carrillo
<mazatlanmexico at yahoo.com> wrote:
> Hi:
> Is there a function that counts the number of days of any given or current year based on the date?
>
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
http://had.co.nz/



More information about the R-help mailing list