In order to quickly read specific rows from a csv, use RSQLite library in R
library(RSQLite)
library(DBI)
con <- dbConnect(RSQLite::SQLite(), "SQLite", dbname = "sample_db.sqlite")
dbWriteTable(con, name="sample_table", value=paste0(data_output_dir,"dm_full_temporal_tmp.csv"),
row.names=FALSE, header=TRUE, sep = "|",overwrite = T)
st <- Sys.time()
# Query your data as you like
yourData <- dbGetQuery(con, "SELECT * FROM sample_table where period in ('201810' , '201802') ")
Sys.time()-st
# 34 sec
dbDisconnect(con)
No comments:
Post a Comment