Problem Description
I created quizzes in r/exams that contain "num" and "string" Answer fields which I am using in Moodle.
I would like to give negative points (e.g. -0.25% of the possible points for that answer) for incorrect answers.
In theory there are functions in r/exams that allow this (exams_eval), but for me they only work in choice questions, not in numeric questions.
I also tried different "rule" settings and variations of the r/exams command but did not got it working. Are negative points not possible for numeric exams?
R/exams Command:
```
exams2moodle("example.Rmd", cloze = list(eval = list(partial = TRUE, rule = "false", negative = -0.25)))
```
Rmd Code (actual code is more complicated, this is just an example for numeric answers):
```
`{r data generation, echo = FALSE, results = "hide"}
a <- 1
b <- 2
n = a + b
m = a * b
sol <- c(n, m)
`
Question
========
Calculate the results of the following tasks:
`r a` + `r b` = ##ANSWER1##
`r a` * `r b` = ##ANSWER2##
Solution
========
The solution is:
`r a` + `r b` = `r n`
`r a` * `r b` = `r m`
Meta-information
================
extype: cloze
exsolution: `r paste(sol, collapse = "|")`
exclozetype: num|num
extol: 0.01
```
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?