Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > library("data.table")
- data.table 1.8.3 For help type: help("data.table")
- > sessionInfo()
- R version 2.15.1 (2012-06-22)
- Platform: x86_64-unknown-linux-gnu (64-bit)
- locale:
- [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
- [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
- [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
- [7] LC_PAPER=C LC_NAME=C
- [9] LC_ADDRESS=C LC_TELEPHONE=C
- [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
- attached base packages:
- [1] stats graphics grDevices utils datasets methods base
- other attached packages:
- [1] data.table_1.8.3 fortunes_1.5-1
- >
- > setClass("DataTable2", contains="data.table")
- >
- > DT1 <- data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9)
- > DT2 <- new("DataTable2", data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9))
- >
- > ## Everything works!
- >
- > tables()
- NAME NROW MB COLS KEY
- [1,] DT1 9 1 x,y,v
- [2,] DT2 9 1 x,y,v
- Total: 2MB
- > is(DT2, "data.table")
- [1] TRUE
- >
- > DT1[2]
- x y v
- 1: a 3 2
- > DT2[2]
- x y v
- 1: a 3 2
- >
- > (bracketMethods1 <- methods("["))
- [1] [.acf* [.AsIs [.bibentry* [.data.frame
- [5] [.data.table* [.Date [.difftime [.factor
- [9] [.formula* [.getAnywhere* [.hexmode [.ITime*
- [13] [.listof [.noquote [.numeric_version [.octmode
- [17] [.pdf_doc* [.person* [.POSIXct [.POSIXlt
- [21] [.raster* [.roman* [.simple.list [.terms*
- [25] [.ts* [.tskernel*
- Non-visible functions are asterisked
- >
- > DT1[,v]
- [1] 1 2 3 4 5 6 7 8 9
- > DT2[,v]
- [1] 1 2 3 4 5 6 7 8 9
- >
- > ## These are the packages loaded/imported by RCurl (and [.data.table workds after them).
- > ## library("tools")
- > ## DT2[,v]
- > ## library("bitops")
- > ## DT2[,v]
- >
- > library("RCurl")
- Loading required package: bitops
- > sessionInfo()
- R version 2.15.1 (2012-06-22)
- Platform: x86_64-unknown-linux-gnu (64-bit)
- locale:
- [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
- [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
- [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
- [7] LC_PAPER=C LC_NAME=C
- [9] LC_ADDRESS=C LC_TELEPHONE=C
- [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
- attached base packages:
- [1] stats graphics grDevices utils datasets methods base
- other attached packages:
- [1] RCurl_1.95-0 bitops_1.0-4.1 data.table_1.8.3 fortunes_1.5-1
- loaded via a namespace (and not attached):
- [1] tools_2.15.1
- >
- > ## This still works
- > DT1[,v]
- [1] 1 2 3 4 5 6 7 8 9
- > ## This no longer works
- > DT2[,v]
- Error: object 'v' not found
- >
- > ## No changes in the S3 methods defined for brackets
- > (bracketMethods2 <- methods("["))
- [1] [.acf* [.AsIs [.bibentry* [.data.frame
- [5] [.data.table* [.Date [.difftime [.factor
- [9] [.formula* [.getAnywhere* [.hexmode [.ITime*
- [13] [.listof [.noquote [.numeric_version [.octmode
- [17] [.pdf_doc* [.person* [.POSIXct [.POSIXlt
- [21] [.raster* [.roman* [.simple.list [.terms*
- [25] [.ts* [.tskernel*
- Non-visible functions are asterisked
- > setdiff(bracketMethods1, bracketMethods2)
- character(0)
- > setdiff(bracketMethods2, bracketMethods1)
- character(0)
- >
Add Comment
Please, Sign In to add comment