-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
I get an error when I try to subset a .POSIXct column when auto indexing is turned on.
library(data.table)
#data.table 1.9.5 For help type: ?data.table
#*** NB: by=.EACHI is now explicit. See README to restore previous behaviour.
options(datatable.auto.index=FALSE) # Have to turn off to avoid error.
DT <- data.table(Time=.POSIXct(0, tz="UTC")+0:1, Value=1:2)
DT[Time==Time[1]]
# Time Value
#1: 1970-01-01 1
DT[Time==.POSIXct(0, tz="UTC")]
# Time Value
#1: 1970-01-01 1
options(datatable.auto.index=TRUE)
DT[Time==Time[1]]
#Error in UseMethod("as.data.table") :
# no applicable method for 'as.data.table' applied to an object of class "c('POSIXct', 'POSIXt')"
DT[Time==.POSIXct(0, tz="UTC")]
#Error in UseMethod("as.data.table") :
# no applicable method for 'as.data.table' applied to an object of class "c('POSIXct', 'POSIXt')"
sessionInfo()
#R version 3.1.1 (2014-07-10)
#Platform: x86_64-pc-linux-gnu (64-bit)
#
#locale:
# [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C
#[5] LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C
#[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
#
#attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
#other attached packages:
# [1] data.table_1.9.5
#
#loaded via a namespace (and not attached):
# [1] chron_2.3-45 tools_3.1.1