[datatable-help] Not getting behavior described in FAQ
Harish
harishv_99 at yahoo.com
Fri May 7 17:08:07 CEST 2010
Hi,
I recently ran across data.table and am experimenting with it. I have a few questions that I am hoping to get your help with.
*** Question #1 ***
I like the concept of data.tables quite a bit and would like to use it as much as possible. However, some other packages I want to use (e.g. ggplot2) need data frames as inputs.
Would I take a huge performance hit if I convert to data frames intermittently and use data.tables as much as possible? Or should I use data.tables only when I have significant querying to do?
*** Question #2 ***
For some reason, FAQ 1.1 and 1.2 do not work for me as described.
I have version 1.4 of the data.table package (downloaded from r-forge today).
Example:
a <- as.data.table(installed.packages())
a[,5]
a[,"Version"]
==> a[,5] does not return 5 as indicated in the FAQ 1.1, but returns the 5th column.
==> a[,"Version"] does not return "Version" as indicated in the FAQ 1.2, but returns the "Version" column.
What is the bug -- the FAQ or the behavior of the code?
*** Question #3 ***
FAQ 1.10 says "although it appears as though x[y] does not return the columns in y, you can actually use the columns from y in the j expression." However, I don't get this behavior.
Example:
x <- data.table( a=rep(letters[1:4], each=3), b=rep(letters[10:12], times=4), v=1:12, key='a,b')
y <- data.table( a=letters[1:3], b=letters[10:12], col3=1:3, key='a,b' )
Then, I expect one of the following to give me col3 from y...
x[y,"col3", with=FALSE]
x[y, list(col3)]
...but I don't.
What am I doing wrong?
BTW, this is a great package.
Regards,
Harish
More information about the datatable-help
mailing list