Berkeley STAT 133 - Accessing a Database from R (4 pages)

Previewing page 1 of 4 page document View the full content.
View Full Document

Accessing a Database from R



Previewing page 1 of actual document.

View the full content.
View Full Document
View Full Document

Accessing a Database from R

44 views

Other


Pages:
4
School:
University of California, Berkeley
Course:
Stat 133 - Concepts in Computing With Data

Unformatted text preview:

1 Accessing a Database from R We have noted already that SQL has limited numerical and statistical features For example it has no least squares fitting procedures and to find quantiles requires a sophisticated query Celko discusses the pros and cons of more than eight different advanced queries to find a median Not only are basic statistical functions missing from SQL but in many cases the numerical algorithms used in the basic aggregate functions are not implemented to safeguard numerical accuracy Also the wide range of data types may have drawbacks when it comes to performing arithmetic calculations across a row as some of the conversions from one numeric type to another may produce unexpected truncation and rounding For these reasons it may be desireable or even necessary to perform a statistical analysis in a statistical package rather than in the database One way to do this is to extract the data from the database and import it into statistical software The statistical software may either reside on the server side i e on the machine which hosts the database or it may reside on the client side i e the user s machine The DBI package in R provides a uniform clientside interface to different database management systems such as MySQL PostgreSQL and Oracle The basic model breaks the interface between the client and the server into three main elements the driver facilitates the communication between the R session and a particular type of database management system e g MySQL the connection encapsulates the actual connection with the aid of the driver to a particular database management system and carries out the requested queries and the result which tracks the status of a query such as the number of rows that have been fetched and whether or not the query has completed The DBI package provides a general interface to a database management system Additional packages that handle the specifics for particular database management systems are required For example the RMySQL



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Accessing a Database from R and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Accessing a Database from R and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?