
Enhancing Exam Creation in Moodle with Customisable Rewards, Shuffling, and Tolerance Levels
Source:R/make_moostr.R
make_moostr.Rd
This package generates a Moodle syntax string for a given list of possible answers and their corresponding rewards. It allows the user to conveniently allocate rewards for multiple correct and partially correct answers It allows users extra flexibility to shuffle options in selected single/multiple choice questions. In addition, for numerical questions, it also allows users to specify different tolerance levels for each correct/partially correct answers.
For the package to function properly, it is necessary to set the question type for both multichoice and numerical questions to the vertatim type.The returned Moodle syntax string can then be directly used as the solution to a verbatim item in an Embedded Answers (Cloze) exercise with exams package or Moodle.
Arguments
- type
string; either "mchoice" or "num"
- ans
a list of possible answers; for "mchoice" type, each possible answer is a string; for "num" type, each possible answer is of numeric type
- reward
a list of corresponding rewards for each possible answer expressed in percentages (0 and 100 inclusive)
- tol
a tolerance level for "num" type; this argument is ignored for "mchoice" type
Examples
# For multichoice type questions
make_moostr(
type = "mchoice",
ans = c(
"A two-sample t-test",
"A paired t-test",
"A one-sample t-test"
),
reward = c(50, 100, 0)
)
#> [1] ":MULTICHOICE:%50%A two-sample t-test~%0%A one-sample t-test~%100%A paired t-test"
# For numerical type questions
make_moostr(
type = "num",
ans = c(2, 2.1, 2.01),
reward = c(30, 100, 50),
tol = c(0, 0.1, 0.01)
)
#> [1] ":NUMERICAL:%30%2:0~%100%2.1:0.1~%50%2.01:0.01"
make_moostr(
type = "num",
ans = c(2, 2.1, 2.01),
reward = c(50, 100, 50),
tol = 0
)
#> [1] ":NUMERICAL:%50%2:0~%100%2.1:0~%50%2.01:0"
make_moostr(
type = "num",
ans = c(2, 2.1, 2.01),
reward = c(30, 100, 50)
)
#> [1] ":NUMERICAL:%30%2:0.01~%100%2.1:0.01~%50%2.01:0.01"