[datatable-help] Unable to find difference between two IDates
Short, Tom
TShort at epri.com
Wed Jun 30 18:55:54 CEST 2010
Harish, I just checked in another attempt at fixing this bug. One side effect this pointed out is a difference in the way I decided to handle as.POSIXct for IDate's. Please note the following difference:
> as.POSIXct( as.Date( "2010-01-01" ))
[1] "2009-12-31 19:00:00 EST"
> as.POSIXct( as.IDate( "2010-01-01" ))
[1] "2010-01-01 UTC"
And also:
> as.POSIXct( as.Date( "2010-01-01" ), tz = "EST5EDT")
[1] "2009-12-31 19:00:00 EST"
> as.POSIXct( as.IDate( "2010-01-01" ), tz = "EST5EDT")
[1] "2010-01-01 EST"
I try to keep IDate's as roundable to dates and revert to UTC (instead of the local time zone) if the time zone isn't specified.
- Tom
> -----Original Message-----
> From: Harish [mailto:harishv_99 at yahoo.com]
> Sent: Tuesday, June 29, 2010 19:42
> To: Short, Tom
> Subject: RE: [datatable-help] Unable to find difference
> between two IDates
>
> Tom,
>
> I am afraid I still have the same issue... I just downloaded
> the latest version from R-Forge (Rev 100). Your fix was in
> Rev 99 I believe.
>
> > install.packages("data.table", repos="http://R-Forge.R-project.org")
> Warning in install.packages("data.table", repos =
> "http://R-Forge.R-project.org") :
> argument 'lib' is missing: using 'C:\Documents and
> Settings\User\My Documents/R/win-library/2.11'
> trying URL
> 'http://R-Forge.R-project.org/bin/windows/contrib/2.11/data.ta
ble_1.5.zip'
> Content type 'application/zip' length 654684 bytes (639 Kb)
> opened URL downloaded 639 Kb
>
> package 'data.table' successfully unpacked and MD5 sums checked
>
> The downloaded packages are in
> C:\Documents and Settings\User\Local
> Settings\Temp\RtmpjXn6zO\downloaded_packages
> > library(data.table)
> > a <- as.IDate( "2010-06-26" )
> > b <- as.IDate( "2010-06-23" )
> > a
> [1] "2010-06-26"
> > b
> [1] "2010-06-23"
> > a-b
> Time difference of NA days
>
>
> Harish
>
>
> --- On Mon, 6/28/10, Short, Tom <TShort at epri.com> wrote:
>
> > From: Short, Tom <TShort at epri.com>
> > Subject: RE: [ ] Unable to find difference between two
> > IDates
> > To: "Harish" <harishv_99 at yahoo.com>,
> > datatable-help at lists.r-forge.r-project.org
> > Date: Monday, June 28, 2010, 6:09 AM
> > Harish, I just committed a fix to
> > R-forge that should fix this bug.
> >
> > - Tom
> >
> >
> > > -----Original Message-----
> > > From: datatable-help-bounces at lists.r-forge.r-project.org
> >
> > > [mailto:datatable-help-bounces at lists.r-forge.r-project.org]
> >
> > > On Behalf Of Harish
> > > Sent: Sunday, June 27, 2010 01:38
> > > To: datatable-help at lists.r-forge.r-project.org
> > > Subject: [datatable-help] Unable to find difference
> > between two IDates
> > >
> > > I am unable to find the difference between two IDate
> > objects.
> > > The way I can get around it is to use
> > Date. Am I doing
> > > something wrong here?
> > >
> > > ============
> > >
> > > a <- as.IDate( "2010-06-26" )
> > > b <- as.IDate( "2010-06-23" )
> > > a - b # Erroneously get "Time difference of NA days"
> > > as.Date( a ) - as.Date( b ) # Correctly get 3 days
> > >
> > > ============
> > >
> > >
> > > Regards,
> > > Harish
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > datatable-help mailing list
> > > datatable-help at lists.r-forge.r-project.org
> > > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/d
> > atatable-help
> > >
> >
>
>
>
>
More information about the datatable-help
mailing list