I am using the following code to import data into my program by SimulationID.
args <- commandArgs(TRUE)
j <- args[1]
library(sqldf)
select <- paste0("select * from file where SimulID=",j,"")
data_sim3 <- read.csv.sql("data_sim3.csv", select)
closeAllConnections()
The problem is that sometimes the import will fail:
Error in connection_import_file(conn@ptr, name, value, sep, eol, skip) : RS_sqlite_import: disk I/O error Calls: read.csv.sql ... dbWriteTable -> dbWriteTable -> .local -> connection_import_file Error: no such savepoint: dbWriteTable_45140_xkusezrrcf Execution halted
Is there a workaround to this problem? Or maybe there is another package. I looked into data.table
which can import based on row number but would prefer to import based on value of column, SimulID. (Also, the file does not have to be saved as a csv, text will also work).
This is a reference: Select specified rows when importing CSV
Thank you.