When loading .csv
using sqldf
everything goes fine until data.table
. For instance:
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 well
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
does not. When loading, data.table
tells 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 is working. Before I put all my code with this trick:
What is the best solution for resolving masking conflicts in R?
EDIT . There is a closely related stream here, but no general solution is proposed.
source share