I created a cloze question combining mchoice and num. However I cannot import the question in Moodle as it says
Error importing question Invalid embedded answers (Cloze) question (One of the answers should have a score of 100% so it is possible to get full marks for this question.).
If I turn it into a single mchoice question (deleting the num question) or I turn it into a single num chestion (deleting the mchoice part) it works. I could not find such an example on r-exams.org, that is why I turned here.
This is my Code:
```{r data generation, echo = FALSE, results = "hide"}
library(exams)
Fragen=data.frame(
Fragen=c(
"Vergleich Schlachtgewicht (g) m?nnlicher und weiblicher Hühner (H?hne/Hennen) der gleichen Linie.",
"Untersuchung der Anzahl Insektenarten, welche auf unterschiedlichen Feldern vorkommen (Magerwiese, Klee, je 10 Felder).",
"Untersuchung Sulfatgehalt (mg) bei Wasserproben aus der Limmat. Die Proben wurden an zwei unterschiedlichen Stellen entnommen (Limmatquai, Werdinsel, w?hrend 14 Tagen)",
"Untersuchung Kürbisgewicht (kg) bei Düngung mit Gülle oder Kompost"),
Stichprobe1=c("Hahn","Magerwiese","Limmatquai","Guelle"),
Stichprobe2=c("Henne","Klee","Werdinsel","Kompost"),
mean1=c(2500,50,250,10),
mean2=c(2000,20,200,12),
sd1=c(300,20,50,5),
sd2=c(300,10,40,5),
n=c(20,10,14,16)
)
n=sample(4,1)
## DATA
x1=abs(round(rnorm(Fragen$n[n],Fragen$mean1[n],Fragen$sd1[n])))
x2=abs(round(rnorm(Fragen$n[n],Fragen$mean2[n],Fragen$sd2[n])))
datadf=data.frame(x1,x2)
names(datadf)=c(as.character(Fragen$Stichprobe1[n]),as.character(Fragen$Stichprobe2[n]))
write.csv(datadf, "stichproben.csv", row.names = FALSE, quote = FALSE)
alpha=0.05
ps1=shapiro.test(x1)$p.value
ps2=shapiro.test(x2)$p.value
pf=var.test(x1,x2)$p.value
if (ps1 > alpha & ps2 > alpha) {
if (pf > alpha) {
p=t.test(x1,x2,var.equal = TRUE)$p.value
}else{
p=t.test(x1,x2,var.equal = FALSE)$p.value
}
}else{
p=wilcox.test(x1,x2)$p.value
}
p
msol=c(ps1>alpha & ps2>alpha, pf>alpha,TRUE)
msol
```
Question
========
`r Fragen$Fragen[n]`
Die Daten sind im File [stichproben.csv](stichproben.csv).
Answerlist
----------
* Die Stichproben sind normalverteilt
* Die Varianzen sind homogen
* Die Stichproben sind unabh?ngig
* Führe den am besten geeigneten Test durch und kopiere den p-Wert ins Feld:
Solution
========
```{r solutionlist, echo = FALSE, results = "asis"}
```
Meta-information
================
exname: t-Test unabhaengig
extype: cloze
exsolution: `r mchoice2string(msol)`|`r format(p)`
exclozetype: mchoice|num
extol: `r format(0.01*p)`
See Question&Answers more detail:
os