Created
March 9, 2014 22:07
-
-
Save ProbablePattern/9455500 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read data | |
dataset=read.csv("/yourdirectory/yourfile.csv",skip=1,header=TRUE) | |
# Create DB | |
testdb=dbConnect(SQLite(), dbname = "/yourdirectory/testdb.dat") | |
# Write the data set into a table called table1 | |
dbWriteTable(testdb,"table1",dataset) | |
# List the tables available in the database | |
dbListTables(testdb) | |
# Remove the original data to free up memory | |
rm(dataset) | |
# Retrieve the entire table | |
dbReadTable(testdb,"table1") | |
# Retrieve the single column called series from the table | |
buf<-dbSendQuery(testdb,"select series from table1") | |
testing<-fetch(buf,n=-1); dbClearResult(buf) | |
dbDisconnect(testdb); rm(buf,testdb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment