2. Source
• Most
of
these
examples
are
taken
from
R
in
Ac'on,
(a
book
by
Rob
Kabacoff
edited
by
Manning
in
2011),
that
I
recommend
to
you
not
only
for
this
course!
3. A
simple
scaKerplot
attach(mtcars)
plot(wt, mpg)
abline(lm(mpg~wt))
title("Regression of MPG on
Weight")
detach(mtcars)
7. Combining
graphs
(II)
attach(mtcars)
par(mfrow=c(2,2)) #2 rows 2 cols
plot(wt,mpg, main="Scatterplot of wt vs. mpg")
plot(wt,disp, main="Scatterplot of wt vs disp")
hist(wt, main="Histogram of wt")
boxplot(wt, main="Boxplot of wt")
8. Scatterplot of wt vs disp
200
300
disp
20
10
100
15
mpg
25
30
400
Scatterplot of wt vs. mpg
2
3
4
5
2
3
4
wt
Histogram of wt
Boxplot of wt
4
6
3
4
2
2
0
Frequency
8
5
wt
2
3
4
wt
5
5
17. Further
resources
R
code
school
(very
nice
intro
for
newbies):
hKp://tryr.codeschool.com/
Quick-‐R
(Rob
Kabacoff
site):
hKp://www.statmethods.net/
R
Zps
(very
detailed):
hKp://pj.freefaculty.org/R/RZps.html
R
seek
(google-‐like
search
bar):
hKp://www.rseek.org/