Reputation: 5617
When loading a .csv
with sqldf
, everything goes fine until I load data.table
. For example:
library(sqldf)
write.table(trees, file="trees.csv", row.names=FALSE, col.names=FALSE, sep=",")
my.df <- read.csv.sql("trees.csv", "select * from file",
header = FALSE, row.names = FALSE)
works, while
library(data.table)
my.df <- read.csv.sql("trees.csv", "select * from file",
header = FALSE, row.names = FALSE)
# Error in list(...)[[1]] : subscript out of bounds
Doesn't. When loaded, data.table
informs you that
The following object(s) are masked from 'package:base':
cbind, rbind
So, I tried this
rbind <- base::rbind # `unmask` rbind from base::
library(data.table)
my.df <- read.csv.sql("trees.csv", "select * from file",
header = FALSE, row.names = FALSE)
rbind <- data.table::rbind # `mask` rbind with data.table::rbind
which works. Before I litter all my code with this trick:
What is the best practise solution to deal with masking conflicts in R?
EDIT: There is a closely related thread here, but no general solution is suggested.
Upvotes: 7
Views: 1460
Reputation: 59602
As per the comments, yes, please file a bug report :
bug.report(package="data.table")
That way it won't be forgotten, you'll get an automatic email each time the status changes and you can reopen it if the fix proves to be insufficient.
EDIT:
Now in v1.6.7 on R-Forge :
do.call("rbind",...)
on an empty ...
) is fixed and test added. data.table was switching on list(...)[[1]]
rather than ..1
. Thanks to RYogi for reporting #1623.Upvotes: 2