Rsqlite can easily create a SQLite database and retrieve it in R, which depends on the DBI package
Address on GitHub: Https://github.com/rstats-db/RSQLite
The introduction to GitHub details how to use Rsqlite to create a database and retrieve data
Basic usage:
Library (rsqlite) " test.db " # Establish a database connection, test.db the name of the database to be created
" Mtcars " , Mtcars) Dbdisconnect (con) # disconnect
When created, will be in the current directory in the generation of a test.db file, this file is our creation of a good SQLite database;
From the command line to see what's inside,
sqlite3 test.dbsqlite Version3.8.11.1 -- -- in -:xx: $Enter". Help" forusage Hints.sqlite>Select*From mtcars Mazda RX4|21.0|6.0|160.0|110.0|3.9|2.62|16.46|0.0|1.0|4.0|4.0Mazda RX4 Wag|21.0|6.0|160.0|110.0|3.9|2.875|17.02|0.0|1.0|4.0|4.0Datsun710|22.8|4.0|108.0|93.0|3.85|2.32|18.61|1.0|1.0|4.0|1.0Hornet4drive|21.4|6.0|258.0|110.0|3.08|3.215|19.44|1.0|0.0|3.0|1.0Hornet sportabout|18.7|8.0|360.0|175.0|3.15|3.44|17.02|0.0|0.0|3.0|2.0Valiant|18.1|6.0|225.0|105.0|2.76|3.46|20.22|1.0|0.0|3.0|1.0Duster the|14.3|8.0|360.0|245.0|3.21|3.57|15.84|0.0|0.0|3.0|4.0
You can see that the data in the table has been successfully inserted;
The packages that connect to the database in R depend on the DBI package, in addition to Rsqlite, Rmysql, Rpostgresql, and other packages that connect to other databases.
Rsqlite Manipulating SQLite database