[R] julian day form POSIXt object

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Thu Sep 29 18:14:38 CEST 2011


On Thu, 29 Sep 2011, maxbre wrote:

> yes, you are perfectly right, sorry for that but for me was not so clear the
> error message!
>
> ....and the third code example I posted (not working either) should be of
> length one (if I'm not wrong again)
>
> but most of all what is not included in my reproducible example and get a
> bit confused my question is the case when the variable "date" contains dates
> of many years and the objective is to count for each given year the julian
> date starting from the first day of the corresponding year

So you aren't really interested in julian day, you are interested in day 
of year.  Julian day maps all calendar time to number of days from a 
SINGLE epoch (origin) which may differ from one problem to the 
next, but not from one value to the next within the problem the way 
"beginning of year" changes for each value.

> how would you deal with this problem?

test$doy <- as.POSIXlt(test$date)$yday+1

> thanks a lot for your help
>
> max
>
> --
> View this message in context: http://r.789695.n4.nabble.com/julian-day-form-POSIXt-object-tp3855885p3856151.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                       Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k



More information about the R-help mailing list