-
Notifications
You must be signed in to change notification settings - Fork 2
/
table.Rmd
128 lines (80 loc) · 6.24 KB
/
table.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
title: "Table Exercises"
output: rmarkdown::html_vignette
date: "`r Sys.Date()`"
vignette: >
%\VignetteIndexEntry{Table Exercises}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup, echo=FALSE}
library(rqti)
```
## Minimum version
In this type of exercise, the candidate must match rows and columns of a table. A template is automatically created when you initiate an rqti project through RStudio. Alternatively, it can be added by clicking on `New file -> R Markdown -> From Template`. The `rqti` templates start with `rqti:`. Here we look at the templates `rqti: table (simple)` and `rqti: table (complex)`.
The minimum you need to provide is the `type: table` in the yaml-section and a table in a section called **\#question**:
```{r comment='', echo = F}
cat(readLines(fs::path_package("rmarkdown/templates/table-simple/skeleton", "skeleton.Rmd", package = "rqti")), sep = '\n')
```
Clicking the Knit-Button will produce:
![Preview of table exercise rendered by QTIJS](images/xml/table-simple.jpg){width=100% border=2px}
Alternatively, change the knit parameter to `knit: rqti::render_opal` (see [API Opal](api_opal.html)) to upload to opal directly, producing:
![](images/table-simple.jpg){width=100%}
The table entries in the Rmd-file contain the number of points for the response. Any number above 0 is considered correct. You can also use negative numbers, which will reduce the points reached, but never below 0. The number of correct responses per row and column can be specified as needed. This usually has an effect on the presentation of the table. For instance, there are special tables where only one row per column is correct and where only one column per row is correct. The `rqti` package takes care of this automatically, so you do not need to do anything. In this regard it is important to know that if you create a table that is actually a directed pair, it will be transformed into a directed pair exercise. If you do not want this, use `as_table = true` in the yaml-section.
The overall points for the exercise are calculated as the sum of the positive table entries.
Of course you can also just load a csv and print it as a markdown table via `knitr::kable(yourtable)`. Just do not forget that the table has to be the last element of the question section.
Note that in this example, a feedback section was also provided. The feedback is
optional, but usually it is a good idea to give some explanation for students.
## More control
If you want to have more fine-grained control, consider the Rmd template `rqti: table (complex)`, which uses more yaml attributes.
```{r comment='', echo = F}
cat(readLines(fs::path_package("rmarkdown/templates/table-complex/skeleton", "skeleton.Rmd", package = "rqti")), sep = '\n')
```
Which, in Opal, renders as:
![Preview of complex table exercise in LMS OPAL](images/table-complex.jpg){width=100%}
You can see that rows and columns are now fixed and there is a more meaningful title.
# yaml attributes
### type
Has to be `table` or `match`.
### identifier
This is the ID of the exercise, useful for later data analysis of results. The default is the file name. If you are doing extensive data analysis later on it makes sense to specify a meaningful identifier. In all other cases, the file name should be
fine.
### title
Title of the exercise. Can be displayed to students depending on the learning management system settings. Default is the file name.
### shuffle
If `true` (the default), randomizes the order of rows and columns. Only in rare occasions it makes sense to have a strict order of elements (setting shuffle to `false`). Overwrites `shuffle_rows` and `shuffle_cols`.
### shuffle_rows
Only shuffle the rows. Default is `true`. Overwritten by `shuffle`.
### shuffle_cols
Only shuffle the columns. Default is `true`. Overwritten by `shuffle`.
### abbr_id
Defines the use of an abbreviation as a way to generate row and column identifiers. Explained in more detail in the section [Managing identifiers](#ids).
## Feedback
Feedback can be provided with the section
- **\# feedback** (general feedback, displayed every time, without conditions)
- **\# feedback+** (only provided if student reaches all points)
- **\# feedback-** (only provided if student does not reach all points)
## Managing identifiers {#ids}
The identifiers of rows and columns are useful for later data analysis of results. If you are doing extensive data analysis later on, it makes sense to specify meaningful identifiers, or at least make them more recognizable.
There are currently two ways to form identifiers of rows and columns:
1. By default `rqti` uses `row_1`...`row_N`, `col_1`...`col_N`.
2. Using `abbr_id: true` in the yaml section of the Rmd file, `rqti` takes the first word of a row or column element and combines it with the abbreviation of the remaining text of the element. Example: for the element "Mean Value Theorem for Integrals" `rqti` makes the identifier "Mean_VTfI". If the row/column starts with digits, "col"/"row" is added as prefix as identifiers are not allowed to start with a number. All special characters are removed.
We experimented with different solutions and settled on these simple versions. If you need more control of the identifiers, please open an issue on github: <https://github.com/shevandrin/rqti/issues> and we will reconsider the options.
<!-- 3. For more control, you might want to assign your own values as identifiers. -->
<!-- ```{markdown} -->
<!-- | ROWID | row | 27 | 36 | 25 | 6 | -->
<!-- |-------------|---------|----|-----|----|---| -->
<!-- | fournine | 4\*9 = | 0 | 0.5 | 0 | 0 | -->
<!-- | threenine | 3\*9 = | 1 | 0 | 0 | 0 | -->
<!-- | fivefive | 5\*5 = | 0 | 0 | 1 | 0 | -->
<!-- | thwothree | 2\*3 = | 0 | 0 | 0 | 1 | -->
<!-- | twelvethree | 12\*3 = | 0 | 1 | 0 | 0 | -->
<!-- ``` -->
## Some advice on table exercises
Table exercises are forced choice exercises, so they suffer from the sample problems as [single choice](singlechoice.html) and [multiple choice](multiplechoice.html) exercises. The advantage of table exercises is that they are easy so manage (e.g. in csv-tables) and many questions can be asked at once, using little space.