[R] Count days of current year

Thomas Petzoldt thpe at simecol.de
Tue Nov 25 09:38:24 CET 2008


Felipe Carrillo wrote:
> Hi:
> Is there a function that counts the number of days of any given or current year based on the date?  

See ?Date and ?strptime and try the following:

y <- as.numeric(format(as.Date("2008-11-25"), "%Y"))

as.numeric(format(as.Date(paste(y, "12", "31", sep="-")), "%j"))


HTH Thomas P.

> 
> 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.



More information about the R-help mailing list