Skip to content

Commit 73da4fa

Browse files
committed
course edits from Dec 2015
1 parent 2aefedb commit 73da4fa

File tree

6 files changed

+36
-34
lines changed

6 files changed

+36
-34
lines changed

day1.Rmd

+4-16
Original file line numberDiff line numberDiff line change
@@ -1332,23 +1332,23 @@ plot(patients$Age,patients$Weight,main="Relationship between Weight and Age")
13321332

13331333
- Adding the x-axis label
13341334
```{r,fig.height=5}
1335-
plot(patients$Age,patients$Weight,xlab="Weight")
1335+
plot(patients$Age,patients$Weight,xlab="Age")
13361336
```
13371337

13381338
## Simple customisations
13391339
- Adding the y-axis label
13401340

13411341
```{r,fig.height=5}
1342-
plot(patients$Age,patients$Weight,ylab="Age")
1342+
plot(patients$Age,patients$Weight,ylab="Weight")
13431343
```
13441344

13451345
## Simple customisations
13461346
- We can specifiy multiple arguments at once
13471347
+ here `ylim` and `xlim` are used to specify axis limits
13481348
```{r,fig.height=5}
13491349
plot(patients$Age,patients$Weight,
1350-
ylab="Age",
1351-
xlab="Weight",
1350+
ylab="Weight",
1351+
xlab="Age",
13521352
main="Relationship between Weight and Age",
13531353
xlim=c(10,70),
13541354
ylim=c(60,80))
@@ -1508,18 +1508,6 @@ display.brewer.all()
15081508
boxplot(weather$Ozone~weather$Month,col=brewer.pal(5,"Set1"))
15091509
```
15101510

1511-
## And finally..
1512-
1513-
```{r eval=FALSE}
1514-
library(palettetown)
1515-
boxplot(weather$Ozone~weather$Month,col=pokepal("Pikachu",5))
1516-
```
1517-
1518-
```{r echo=FALSE, message=FALSE,fig.height=5}
1519-
if(!require(palettetown)) install.packages("palettetown")
1520-
library(palettetown)
1521-
boxplot(weather$Ozone~weather$Month,col=pokepal("Pikachu",5))
1522-
```
15231511

15241512

15251513

day1.html

+10-10
Large diffs are not rendered by default.

day2.Rmd

+11-4
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ dev.off()
259259
```
260260

261261
- pdf is a good choice for publication as they can be imported into photoshop, inkscape etc
262+
- sometimes it is easier to edit in these tools than R!
262263

263264
## Exporting graphs from RStudio
264265

@@ -469,15 +470,15 @@ points(80, dnorm(80, mean=tempMean,sd=tempSD),col="red",pch=16)
469470
```{r eval=FALSE}
470471
xs <- c(50,60,70,80,90,100)
471472
ys <- dnorm(xs, mean=tempMean,sd=tempSD)
472-
lines(xs,ys,col="red",pch=16)
473+
lines(xs,ys,col="red")
473474
```
474475

475476
```{r fig.height=4,echo=FALSE}
476477
hist(weather$Temp,col="purple",xlab="Temperature",
477478
main="Distribution of Temperature",breaks = 50:100,freq=FALSE)
478479
xs <- c(50,60,70,80,90,100)
479480
ys <- dnorm(xs, mean=tempMean,sd=tempSD)
480-
lines(xs,ys,col="red",pch=16)
481+
lines(xs,ys,col="red")
481482
```
482483

483484

@@ -490,7 +491,7 @@ lines(xs,ys,col="red",pch=16)
490491
```{r eval=FALSE}
491492
xs <- seq(50,100,length.out = 10000)
492493
ys <- dnorm(xs, mean=tempMean,sd=tempSD)
493-
lines(xs,ys,col="red",pch=16)
494+
lines(xs,ys,col="red")
494495
```
495496

496497

@@ -500,7 +501,7 @@ hist(weather$Temp,col="purple",xlab="Temperature",
500501
main="Distribution of Temperature",breaks = 50:100,freq=FALSE)
501502
xs <- seq(50,100,length.out = 10000)
502503
ys <- dnorm(xs, mean=tempMean,sd=tempSD)
503-
lines(xs,ys,col="red",pch=16)
504+
lines(xs,ys,col="red")
504505
```
505506

506507
## Simple testing
@@ -706,6 +707,12 @@ plot(weather$Temp, weather$Ozone,pch=16)
706707
abline(mod1,col="red",lty=2)
707708
```
708709

710+
## Word of caution
711+
712+
***Correlation != Causation***
713+
![spurious](images/spurious.png)
714+
715+
http://tylervigen.com/spurious-correlations
709716

710717
# 3. Data Manipulation Techniques
711718

day2.html

+11-4
Large diffs are not rendered by default.

images/NYTimes_R_Article.png

100755100644
File mode changed.

images/spurious.png

55.8 KB
Loading

0 commit comments

Comments
 (0)