Chapter I. Introduction to R: the basic objects
In order to work with a language we need to know its syntax
and its objects.
In terms of the syntax, we have seen how to use variables and
functions. We will learn more as we progress.
This section foc
Chap I: Introduction to R: More on the syntax
Control structures are useful to implement repetitive tasks.
R has control structures similar to C .
Loops are used to carry out a sequence of related operations
Working with relational databases (continued)
The SELECT statement
There is a programming language called SQL (Structured
Query Language) to manipulate relational DB. We will learn
how to use SQL to read data from relational DB.
Remember that a databa
drv = dbDriver('SQLite')
conn = dbConnect(drv,'baseball.db')
sqltext = "SELECT COUNT(playerID) AS nb_left_players FROM MASTER WHERE bats =
dt1 = dbGetQuery(conn,sqltext)
# How about the counts for all levels of bats
sqltext = "SELECT
Working with relational databases
Why use a database?
Database systems (DBS) are a very popular way of storing
data. They are particularly efficient in dealing with large data
Think of a DBS as a dataset managed by a software (known
as the datab