I have a 9GB .csv file and would like to convert it to an sqlite data base.
I have followed https://datacarpentry.org/R-ecology-lesson/05-r-and-databases.html#Connecting_to_databases and it works on my local machine but on a server it says the disk/database is full. In any case, on the local machine, the DB file appears to be 0KB and contains no tables. Any thoughts why?
This is what I do:
library(dplyr)
library(dbplyr)
#Test data
df<-as.data.frame(x1=runif(1e7),x2=runif(1e7))
#Make DB
PassengerData <- src_sqlite("FINAL_data.sqlite", create = TRUE)
#Copy dataframe to DB
copy_to(PassengerData,df)
# add my data.frame as a table
PassengerData<-tbl(PassengerData,"df")
Then I close R and open a new session:
To Look at the DB I do:
df<-DBI::dbConnect(RSQLite::SQLite(), "FINAL_data.sqlite")
src_dbi(df)
src: sqlite 3.34.1 [Data/FINAL_data.sqlite]
tbls:
There are no tables in it. Why?