As yearmon represents year/month as year + fraction of year adding 1 gives next year. The first output below gives an answer of class "difftime" whereas the the second solution is "numeric":
> library(zoo) > year <- 2000:2010 > d <- as.Date(as.yearmon(year)+1) - as.Date(as.yearmon(year)) > d Time differences in days [1] 366 365 365 365 366 365 365 365 366 365 365 > # or to get a numeric answer: > as.double(d, units = "days") [1] 366 365 365 365 366 365 365 365 366 365 365 On Mon, Nov 24, 2008 at 2:25 PM, Felipe Carrillo <[EMAIL PROTECTED]> 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 > > ______________________________________________ > [email protected] 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. > ______________________________________________ [email protected] 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.

