Rsqlite Manipulating SQLite database

Source: Internet
Author: User
Tags sqlite sqlite database

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.