On Tue, Mar 15, 2011 at 11:42 PM, Raoni Rosa Rodrigues
<raonir...@yahoo.com.br> wrote:
> Hello Mr. Grothendieck,
>
> thanks for your reply!
>
> Text book that I use (Spector, 2008) dind't comment about this feature of 
> chron function...
>
> I just don't understand why we have 10957 days of difference between dates 
> (look that date on your mail seems to be 1981, not 2011), and not the 25568 
> days expected due the difference in origin: 1/1/1900 of excel against 
> 1/1/1970 of chron package.
>

As mentioned in my last post you can adjust for that.  To be explicit,
calculate the difference, d, between origins and adjust all date/times
by that amount:

> # Difference between what you get & what you want
> as.numeric(chron(floor(40597.3911423958)) - chron("2/23/2011"))
[1] 25569
>
> # Difference between origins
> # This should match last calculation.
> d <- as.numeric(chron(0) - chron("12/30/1899"))
[1] 25569
>
> # now that we have d we adjust all dates using it
> chron(40597.3911423958) - d
[1] (02/23/11 09:23:15)

As mentioned in R News 4/1 there is an option to set chron's origin
but its not recommended that you use the chron options and its
preferable to simply adjust all dates as shown.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
R-help@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.

Reply via email to