-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
84 lines (66 loc) · 3.55 KB
/
README.Rmd
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# homework
The `homework` package let's R teachers automatically check homeworks that they are giving to their students. A recommended workflow is to have a master directory for all homework files, and then a sub-directory for each homework assignment (such as "HW01", "HW02", etc.). The master directory will have a `check_hw_master.R` master file to include the code to check homework everyweek. A subfolder of homework (say, HW01, HW02, etc.), must have a folder with the submissions of the students (called "submissions"), an R file with the correct solutions (it should be called solutions.R or hw01_solutions.R). The submissions folder can include one zip file with all assignments, or just all the assignments (each student's assignment is an R file). An answer for each homework question should be a function (for example "write a function that calculates the sum of a vector"). The solution file should include an object called `tests_to_run` at the end of it. This object is a nested list, each element of the list is a name of a function that the hw has asked for, and in it is either a list of possible inputs to check against the function, OR, a list of lists, each sublist will check some other input (see later for an example). After running the `check_hw` on the subdirectory "HW01", the function will create a "mistakes" folder with an .R file for each function in the hw, and in the files will be a list of the mistakes that were found for each question/student. There is also a "grades" folder, with a csv including the grades of students (based on the filenames the students submit). The standard of the filenames of hw assignment is assingment_number_student_id.R (e.g.: 01_123456.R). In the grades folder there is the grades file we need for giving students the grade at the end of the course, plus a file to send the students (this one will include only the first 5 characters of the student's id, so that people won't know who got which grade).
An example of a folder structure before running check_hw:
```
hw
-check_hw_master.R
-hw01
--submissions
---students_homework.zip (maybe from moodle)
--hw01_solutions.R (includes the corrects functions and the inputs to check)
--hw.txt/hw.pdf/hw.docx/etc. (ignored)
-hw02
--...
-hw03
--...
```
Folder structure AFTER running check_hw:
```
hw
-check_hw_master.R
-hw01
--submissions
---students_homework.zip (maybe from moodle)
---01_123456.R
---01_456987.R
---01_879456.R
--hw01_solutions.R (includes the corrects functions and the inputs to check)
--mistakes
---mistakes_in_foo.R
---mistakes_in_bar.R
--grades
---grades.csv
---grades_for_students.csv
--hw.txt/hw.pdf/hw.docx/etc. (ignored)
-hw02
--...
-hw03
--...
```
## Installation
You can install homework from github with:
```{r gh-installation, eval = FALSE}
if(!requireNamespace("remotes", quietly=TRUE)) install.packages("remotes")
remotes::install_github("talgalili/homework")
```
## Example
The package comes with a simple example. The following code shows where the example is, and how to run a homework check on it.
Some of the homework file have intentional problems in them to deomnstrate how the function is able to deal with them:
```{r example}
library(homework)
# it is best to just create an RStudio project for the homework checking of a course...
demo_base_dir <- file.path(system.file(package = "homework"), "extdata")
demo_base_dir
check_hw("HW01", demo_base_dir)
```