LMSouq
moodle-core Open

Generate Moodle exercises with images using the exams package

SI
Sinval
1 month ago
3 views
Problem Description
I am using the `exams` package, I want to generate some Moodle exercises with it which incorporate some images. Although using this code in a `*rmd` file: ```{r, echo = FALSE, results = "hide"} exams::include_supplement("ae1_2_1e2.png") ``` Question ======== Question text: \centering $\includegraphics[width=0.55 \textwidth] {ae1_2_1e2.png}$ Answerlist ---------- * answer a * answer b * answer c * answer d Solution ======== Answerlist ---------- * True * False * False * False Meta-information ================ exname: ae1_2_1 extype: schoice exsolution: 1000 exshuffle: 4 Which produces this results in Moodle: [![Image][1]][1] Another question is, does the package allows to use images as options in the Moddle exercises (i.e. schoice)? Example: ```{r, echo = FALSE, results = "hide", out.width = "20%"} exams::include_supplement(c("ae4_3_2_1e2.png","ae4_3_2_3e4.png")) ``` Question ======== For a right-tailed test (using the Neyman-Pearson criteria), which would be the rejection region for a t-test (independent samples)? Answerlist ---------- * \ ![](ae4_3_2_1e2.png) $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1+n_2-2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1+n_2-2)};+\infty\bigg[$. * \ ![](ae4_3_2_1e2.png) $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1-n_2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1-n_2)};+\infty\bigg[$. * \ ![](ae4_3_2_3e4.png) $\bigg[t_{1-\alpha;(n_1-n_2)};+\infty\bigg[$. * \ ![](ae4_3_2_3e4.png) $\bigg[t_{1-\alpha;(n_1+n_2-2)};+\infty\bigg[$. [![enter image description here][2]][2] **SOLVED** You cannot have the same image file in different options. If you want to use the same image, you have to produce a copy of it and use a different name. So the new code: ```{r, echo = FALSE, results = "hide", out.width = "20%"} exams::include_supplement(c("ae4_3_2_1.png","ae4_3_2_3.png","ae4_3_2_2.png","ae4_3_2_4.png")) ``` Question ======== For a right-tailed test (using the Neyman-Pearson criteria), which would be the rejection region for a t-test (independent samples)? Answerlist ---------- * \ ![](ae4_3_2_1.png){width=20%} $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1+n_2-2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1+n_2-2)};+\infty\bigg[$. * \ ![](ae4_3_2_2.png){width=20%} $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1-n_2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1-n_2)};+\infty\bigg[$. * \ ![](ae4_3_2_3.png){width=20%} $\bigg[t_{1-\alpha;(n_1-n_2)};+\infty\bigg[$. * \ ![](ae4_3_2_4.png){width=20%} $\bigg[t_{1-\alpha;(n_1+n_2-2)};+\infty\bigg[$. Meta-informatio...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base