Re: [R] day of the year for chron objects

2012-06-08 Thread Agustin Lobo
Thanks Gabor, The trick to solve my problem is the %j, many thanks. I've seen now it's documented in the help page of strptime as you indicate. But please note that using format="ymd" I do get a chron object and note that the value is the date without the 2 first digits > require(chron) Loading

Re: [R] day of the year for chron objects

2012-06-08 Thread Gabor Grothendieck
On Fri, Jun 8, 2012 at 7:16 AM, Jannis wrote: > The following appears to be pretty "standard" (though not included in chron) > to me: > >  b = ISOdate(2001,12,12) >  format(b, '%j') > Using POSIXct here is error prone because it needlessly introduces time zones into a problem where they are not r

Re: [R] day of the year for chron objects

2012-06-08 Thread Jannis
The following appears to be pretty "standard" (though not included in chron) to me: b = ISOdate(2001,12,12) format(b, '%j') or is that what you refer to with "I know I can make my own using julian" ? No idea about the other questions though ... Jannis On 08.06.2012 10:01, Agustin Lobo w

Re: [R] day of the year for chron objects

2012-06-08 Thread Gabor Grothendieck
On Fri, Jun 8, 2012 at 4:01 AM, Agustin Lobo wrote: > Hi! > Is not there an standard R function to retrieve the day of the year > (since 1st Jan of the same year)? > I know I can make my own using julian, but find it weird that having > days(), months() etc doy() does not exist as an standard func

Re: [R] day of the year for chron objects

2012-06-08 Thread Carlos Ortega
Hi Agustin, You can check and adapt this solution to your needs: http://stackoverflow.com/questions/9465817/count-days-per-year Regards, Carlos Ortega www.qualityexcellence.es 2012/6/8 Agustin Lobo > Hi! > Is not there an standard R function to retrieve the day of the year > (since 1st Jan of

[R] day of the year for chron objects

2012-06-08 Thread Agustin Lobo
Hi! Is not there an standard R function to retrieve the day of the year (since 1st Jan of the same year)? I know I can make my own using julian, but find it weird that having days(), months() etc doy() does not exist as an standard function. Also, is the following not a bit inconsistent? > a <- c