The following counts were obtained by inspecting the uploaded files, but without trying to run R yet.

- 329 students are enrolled in the module
- 274 out of 329 students (83.3%) submitted a solution
- 247 (90.1%) — probably an R script [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [245] [246] [247]
- 12 (4.4%) — probably an R script, but without functions [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
- 6 (2.2%) — no file attached
- 2 (0.7%) — possibly an R script, but without functions [1] [2]
- 2 (0.7%) — possibly an R script [1] [2]
- 2 (0.7%) — not an R script, unknown file type
- 2 (0.7%) — not an R script, possibly an .Rdata file
- 1 (0.4%) — not an R script, possibly Microsoft Word 2007+

- 263 out of 274 files (96.0%) can be marked

I tried to load all solutions which are possibly R scripts into R.

- 263 files were loaded into R

The following list shows some of the errors which prevented files from being loaded:

> ex 5 <- function(x) { Error: unexpected numeric constant in "ex 5"

[source]> x <- read.csv("01.csv",na.strings=c("NA", "-")) Error in file(file, "rt") : cannot open the connection Calls: read.csv -> read.table -> file In addition: Warning message: In file(file, "rt") : cannot open file '01.csv': No such file or directory

[source]> ex5 function(x){ Error: unexpected 'function' in "ex5 function"

[source]> basic good medium none Error: unexpected symbol in " basic good"

[source]+ length(which(x[,"gender"=="f")) Error: unexpected ')' in: "ex8 <- function(x) { length(which(x[,"gender"=="f")"

[source]> x <- read.csv("01.csv") Error in file(file, "rt") : cannot open the connection Calls: read.csv -> read.table -> file In addition: Warning message: In file(file, "rt") : cannot open file '01.csv': No such file or directory

[source]> h<-x$height Error: object 'x' not found

[source]+ } Error: unexpected '}' in: "sum(x[,1]=="m"|x[,3]=="1" }"

[source]> x<-read.csv("Data 1.csv") Error in file(file, "rt") : cannot open the connection Calls: read.csv -> read.table -> file In addition: Warning message: In file(file, "rt") : cannot open file 'Data 1.csv': No such file or directory

[source]+ x[(which(x$height==max(x$height, na.rm=TRUE))), "travel" + Error: unexpected end of input

[source]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex5 <- function(x) { nrow(x) }[source]

For marking your answer, I called the function `ex5()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 235 answers were marked
- 229 (97.4%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [227] [228] [229]
- 2 (0.9%) — failed with error [1] [2]
- 1 (0.4%) — full data: expected 220 but got c(220, 5); first 100 rows: expected 100 but got c(100, 5) [1]
- 1 (0.4%) — full data: expected 220 but got a function; first 100 rows: expected 100 but got a function [1]
- 1 (0.4%) — full data: expected 220 but got a data frame; first 100 rows: expected 100 but got a data frame [1]
- 1 (0.4%) — full data: expected 220 but got NULL; first 100 rows: expected 100 but got NULL [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex6 <- function(x) {mean(x$travel) }[source]

For marking your answer, I called the function `ex6()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 234 answers were marked
- 216 (92.3%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [214] [215] [216]
- 5 (2.1%) — full data: ok; first 100 rows: expected 17.62 but got NA [1] [2] [3] [4] [5]
- 5 (2.1%) — full data: expected 19.15 but got NA; first 100 rows: expected 17.62 but got NA [1] [2] [3] [4] [5]
- 3 (1.3%) — failed with error [1] [2] [3]
- 2 (0.9%) — full data: expected 19.15 but got a table; first 100 rows: expected 17.62 but got a table [1] [2]
- 1 (0.4%) — full data: expected 19.15 but got a vector; first 100 rows: expected 17.62 but got a vector [1]
- 1 (0.4%) — full data: expected 19.15 but got NULL; first 100 rows: expected 17.62 but got NULL [1]
- 1 (0.4%) — full data: expected 19.15 but got 15; first 100 rows: expected 17.62 but got 15 [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex7 <- function(x) {mean(x$height,na.rm=TRUE) }[source]

For marking your answer, I called the function `ex7()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 233 answers were marked
- 204 (87.6%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [202] [203] [204]
- 13 (5.6%) — failed with error [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]
- 10 (4.3%) — full data: expected 173.7 but got NA; first 100 rows: expected 172.7 but got NA [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
- 1 (0.4%) — full data: expected 173.7 but got a vector; first 100 rows: expected 172.7 but got a vector [1]
- 1 (0.4%) — full data: expected 173.7 but got a table; first 100 rows: expected 172.7 but got a table [1]
- 1 (0.4%) — full data: expected 173.7 but got NULL; first 100 rows: expected 172.7 but got NULL [1]
- 1 (0.4%) — full data: expected 173.7 but got 19.15; first 100 rows: expected 172.7 but got 17.62 [1]
- 1 (0.4%) — full data: expected 173.7 but got 175; first 100 rows: expected 172.7 but got 173 [1]
- 1 (0.4%) — full data: expected 173.7 but got 102; first 100 rows: expected 172.7 but got 51 [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex8 <- function(x) {g <- x$gender sum(g=="f") }[source]

For marking your answer, I called the function `ex8()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 230 answers were marked
- 218 (94.8%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [216] [217] [218]
- 5 (2.2%) — failed with error [1] [2] [3] [4] [5]
- 3 (1.3%) — full data: expected 102 but got a table; first 100 rows: expected 51 but got a table [1] [2] [3]
- 2 (0.9%) — full data: expected 102 but got a vector; first 100 rows: expected 51 but got a vector [1] [2]
- 1 (0.4%) — full data: expected 102 but got c(102, 118); first 100 rows: expected 51 but got c(51, 49) [1]
- 1 (0.4%) — full data: expected 102 but got NULL; first 100 rows: expected 51 but got NULL [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex9 <- function(x) {sum(table(x$gender,x$hand)[2,2]) }[source]

For marking your answer, I called the function `ex9()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 230 answers were marked
- 190 (82.6%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [188] [189] [190]
- 15 (6.5%) — full data: expected 10 but got 0; first 100 rows: expected 6 but got 0 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
- 8 (3.5%) — full data: expected 10 but got 107; first 100 rows: expected 6 but got 42 [1] [2] [3] [4] [5] [6] [7] [8]
- 7 (3.0%) — failed with error [1] [2] [3] [4] [5] [6] [7]
- 3 (1.3%) — full data: expected 10 but got 11; first 100 rows: expected 6 but got 7 [1] [2] [3]
- 2 (0.9%) — full data: expected 10 but got a table; first 100 rows: expected 6 but got a table [1] [2]
- 2 (0.9%) — full data: expected 10 but got NULL; first 100 rows: expected 6 but got NULL [1] [2]
- 1 (0.4%) — full data: expected 10 but got c(15, 20, 38, 60, 61, 62, 102, 113, 147, 199); first 100 rows: expected 6 but got c(15, 20, 38, 60, 61, 62) [1]
- 1 (0.4%) — full data: expected 10 but got a vector; first 100 rows: expected 6 but got a vector [1]
- 1 (0.4%) — full data: expected 10 but got 220; first 100 rows: expected 6 but got 100 [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex10 <- function(x) {( sum(x$gender=="m")+sum(x$hand=="l"))-(sum((x$gender=="m")&(x$hand=="l"))) }[source]

For marking your answer, I called the function `ex10()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 221 answers were marked
- 155 (70.1%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [153] [154] [155]
- 25 (11.3%) — full data: expected 126 but got 136; first 100 rows: expected 51 but got 57 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [23] [24] [25]
- 14 (6.3%) — full data: expected 126 but got 118; first 100 rows: expected 51 but got 49 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]
- 4 (1.8%) — full data: expected 126 but got 18; first 100 rows: expected 51 but got 8 [1] [2] [3] [4]
- 4 (1.8%) — full data: expected 126 but got 115; first 100 rows: expected 51 but got 44 [1] [2] [3] [4]
- 4 (1.8%) — failed with error [1] [2] [3] [4]
- 2 (0.9%) — full data: expected 126 but got a vector; first 100 rows: expected 51 but got a vector [1] [2]
- 2 (0.9%) — full data: expected 126 but got a table; first 100 rows: expected 51 but got a table [1] [2]
- 2 (0.9%) — full data: expected 126 but got NULL; first 100 rows: expected 51 but got NULL [1] [2]
- 2 (0.9%) — full data: expected 126 but got 116; first 100 rows: expected 51 but got 45 [1] [2]
- 1 (0.5%) — full data: expected 126 but got 3; first 100 rows: expected 51 but got 3 [1]
- 1 (0.5%) — full data: expected 126 but got 319; first 100 rows: expected 51 but got 140 [1]
- 1 (0.5%) — full data: expected 126 but got 248; first 100 rows: expected 51 but got 113 [1]
- 1 (0.5%) — full data: expected 126 but got 220; first 100 rows: expected 51 but got 100 [1]
- 1 (0.5%) — full data: expected 126 but got 201; first 100 rows: expected 51 but got 91 [1]
- 1 (0.5%) — full data: expected 126 but got 128; first 100 rows: ok [1]
- 1 (0.5%) — full data: expected 126 but got 108; first 100 rows: expected 51 but got 43 [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex11 <- function(x) { table(x$R) }[source]

For marking your answer, I called the function `ex11()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 232 answers were marked
- 218 (94.0%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [216] [217] [218]
- 4 (1.7%) — full data: expected a table of length 4 but got a 4 by 1 table; first 100 rows: expected a table of length 4 but got a 4 by 1 table [1] [2] [3] [4]
- 2 (0.9%) — full data: expected a table of length 4 but got a 4 by 2 table; first 100 rows: expected a table of length 4 but got a 4 by 2 table [1] [2]
- 2 (0.9%) — failed with error [1] [2]
- 1 (0.4%) — full data: ok; first 100 rows: expected a table of length 4 but got a different a table of length 4 [1]
- 1 (0.4%) — full data: expected a table of length 4 but got a table of length 25; first 100 rows: expected a table of length 4 but got a table of length 17 [1]
- 1 (0.4%) — full data: expected a table of length 4 but got a table of length 0; first 100 rows: expected a table of length 4 but got a table of length 0 [1]
- 1 (0.4%) — full data: expected a table of length 4 but got a 2 by 4 table; first 100 rows: expected a table of length 4 but got a 2 by 4 table [1]
- 1 (0.4%) — full data: expected a table but got c(157, 4, 28, 31); first 100 rows: expected a table but got c(74, 1, 13, 12) [1]
- 1 (0.4%) — full data: expected a table but got NULL; first 100 rows: expected a table but got NULL [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex12 <- function(x) { table(x$gender, x$R) }[source]

For marking your answer, I called the function `ex12()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 236 answers were marked
- 216 (91.5%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [214] [215] [216]
- 6 (2.5%) — failed with error [1] [2] [3] [4] [5] [6]
- 5 (2.1%) — full data: expected a 2 by 4 table but got a 3 by 5 table; first 100 rows: expected a 2 by 4 table but got a 3 by 5 table [1] [2] [3] [4] [5]
- 2 (0.8%) — full data: expected a 2 by 4 table but got a 5 by 3 table; first 100 rows: expected a 2 by 4 table but got a 5 by 3 table [1] [2]
- 1 (0.4%) — full data: expected a table but got NULL; first 100 rows: expected a table but got NULL [1]
- 1 (0.4%) — full data: expected a table but got 118; first 100 rows: expected a table but got 49 [1]
- 1 (0.4%) — full data: expected a table but got 0.4643; first 100 rows: expected a table but got 0.5385 [1]
- 1 (0.4%) — full data: expected a 2 by 4 table but got a table of length 4; first 100 rows: expected a 2 by 4 table but got a table of length 4 [1]
- 1 (0.4%) — full data: expected a 2 by 4 table but got a 4 by 2 table; first 100 rows: expected a 2 by 4 table but got a 4 by 2 table [1]
- 1 (0.4%) — full data: expected a 2 by 4 table but got a 3 by 4 table; first 100 rows: expected a 2 by 4 table but got a 3 by 4 table [1]
- 1 (0.4%) — full data: expected a 2 by 4 table but got a 25 by 2 table; first 100 rows: expected a 2 by 4 table but got a 17 by 2 table [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex13 <- function(x) { z = sum(x$gender == "f" & x$R == "good") y = sum(x$R == "good") z/y }[source]

For marking your answer, I called the function `ex13()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 221 answers were marked
- 154 (69.7%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [152] [153] [154]
- 16 (7.2%) — failed with error [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [14] [15] [16]
- 15 (6.8%) — full data: expected 0.25 but got 0.009804; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
- 9 (4.1%) — full data: expected 0.25 but got 0.004545; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9]
- 4 (1.8%) — full data: expected 0.25 but got 0.03922; first 100 rows: expected 0 but got 0.01961 [1] [2] [3] [4]
- 4 (1.8%) — full data: expected 0.25 but got 0.01364; first 100 rows: expected 0 but got 0.01 [1] [2] [3] [4]
- 3 (1.4%) — full data: expected 0.25 but got 0.3333; first 100 rows: ok [1] [2] [3]
- 2 (0.9%) — full data: expected 0.25 but got NULL; first 100 rows: expected 0 but got NULL [1] [2]
- 2 (0.9%) — full data: expected 0.25 but got 0.7458; first 100 rows: expected 0 but got 0.7755 [1] [2]
- 1 (0.5%) — full data: expected 0.25 but got a table; first 100 rows: expected 0 but got a table [1]
- 1 (0.5%) — full data: expected 0.25 but got 20; first 100 rows: expected 0 but got 20 [1]
- 1 (0.5%) — full data: expected 0.25 but got 2.275; first 100 rows: expected 0 but got 2.056 [1]
- 1 (0.5%) — full data: expected 0.25 but got 1; first 100 rows: expected the double 0 but got the integer 0 [1]
- 1 (0.5%) — full data: expected 0.25 but got 1; first 100 rows: expected 0 but got 1 [1]
- 1 (0.5%) — full data: expected 0.25 but got 0.75; first 100 rows: expected 0 but got 1 [1]
- 1 (0.5%) — full data: expected 0.25 but got 0.4643; first 100 rows: expected 0 but got 0.5385 [1]
- 1 (0.5%) — full data: expected 0.25 but got 0.4444; first 100 rows: expected 0 but got 0.25 [1]
- 1 (0.5%) — full data: expected 0.25 but got 0.3333; first 100 rows: expected 0 but got 0.3333 [1]
- 1 (0.5%) — full data: expected 0.25 but got 0.06818; first 100 rows: expected 0 but got 0.06 [1]
- 1 (0.5%) — full data: expected 0.25 but got 0.01136; first 100 rows: ok [1]
- 1 (0.5%) — full data: expected 0.25 but got 0.004545; first 100 rows: expected 0 but got 0.01 [1]

As an example, here is a (randomly chosen) student solution which got 0.5 marks:

ex14 <- function(x) { maxheight <- max(x$height, na.rm=TRUE) x[which(x$height==maxheight),4] }[source]

For marking your answer, I called the function `ex14()` twice,
once for the full data set `x` and once for the first 100 rows
`x[1:100,]`. The results were as follows:

- 209 answers were marked
- 128 (61.2%) — full data: ok; first 100 rows: ok [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [126] [127] [128]
- 40 (19.1%) — failed with error [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [38] [39] [40]
- 16 (7.7%) — full data: expected 20 but got 12; first 100 rows: expected 20 but got NA [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [14] [15] [16]
- 5 (2.4%) — full data: expected 20 but got 195.6; first 100 rows: expected 20 but got 195.6 [1] [2] [3] [4] [5]
- 4 (1.9%) — full data: expected 20 but got an empty vector; first 100 rows: expected 20 but got an empty vector [1] [2] [3] [4]
- 4 (1.9%) — full data: expected 20 but got NULL; first 100 rows: expected 20 but got NULL [1] [2] [3] [4]
- 4 (1.9%) — full data: expected 20 but got 15; first 100 rows: expected 20 but got 15 [1] [2] [3] [4]
- 2 (1.0%) — full data: expected 20 but got NA; first 100 rows: expected 20 but got NA [1] [2]
- 2 (1.0%) — full data: expected 20 but got 0; first 100 rows: expected 20 but got 0 [1] [2]
- 1 (0.5%) — full data: expected 20 but got a vector; first 100 rows: expected 20 but got a vector [1]
- 1 (0.5%) — full data: expected 20 but got a table; first 100 rows: expected 20 but got a table [1]
- 1 (0.5%) — full data: expected 20 but got 72; first 100 rows: expected 20 but got 72 [1]
- 1 (0.5%) — full data: expected 20 but got 102; first 100 rows: expected 20 but got 51 [1]

- 55 — not handed in
- 41 — 0.0 marks [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [28] [29] [30]
- 4 — 0.5 marks [1] [2] [3] [4]
- 3 — 1.0 marks [1] [2] [3]
- 6 — 1.5 marks [1] [2] [3] [4] [5] [6]
- 11 — 2.0 marks [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
- 11 — 2.5 marks [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
- 17 — 3.0 marks [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [15] [16] [17]
- 31 — 3.5 marks [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [29] [30] [31]
- 29 — 4.0 marks [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [27] [28] [29]
- 63 — 4.5 marks [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [61] [62] [63]
- 58 — 5.0 marks [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] … [56] [57] [58]