/
daneman1980.R
42 lines (28 loc) · 994 Bytes
/
daneman1980.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# daneman1980.R, 29 May 20
# Data from:
# Individual Differences in Working Memory and Reading
# Meredyth Daneman and Patricia A. Carpenter
#
# Example from:
# Evidence-based Software Engineering: based on the publicly available data
# Derek M. Jones
#
# TAG experiment_human reading_text text_prose comprehension_text
source("ESEUR_config.r")
library("plyr")
pal_col=rainbow(4)
plot_span=function(df)
{
lines(df$Distance, df$Correct, col=df$col_str, type="b")
}
dane=read.csv(paste0(ESEUR_dir, "sourcecode/daneman1980.csv.xz"), as.is=TRUE)
dane$col_str=mapvalues(dane$Read_span, 2:5, pal_col)
plot(0, type="n",
xaxt="n", yaxs="i",
xlim=c(1, 3), ylim=c(0, max(dane$Correct)+0.1),
xlab="Sentences between information", ylab="Correct responses (percent)\n")
axis(1, at=1:3, labels=c("2-3", "4-5", "6-7"))
d_ply(dane, .(Read_span), plot_span)
# Align legend colors with plot order
legend(x="bottomleft", legend=paste0("reading span ", 5:2), bty="n", fill=rev(pal_col), cex=1.2)