I would like to use your excellent r-exams package to create a paper and pencil exam with automatic grading. I have used exams2nops in the past for a series of schoice and mchoice questions.
However, I now need to have an exam with an introduction page where I give a table with data and some outputs from statistical software (say normality tests, Levene, etc... I can generate that with Rmd)and tell a small history about the data and the experiments involved in gathering the data.
So My Exam structure would be:
Page 1. Box for student's name and number and Answer sheet
Page 2. Introductory page with dataset and selected figures/outputs for testing assumptions (and no questions)
Page 3. Question 1.1
Page 4. Question 1.2. ... Page k: Question n.
Would this be possible. I guess the novelty is the "intro" page ... after that is just an exams2nops file....
Thanks in advance for any ideas or thoughts...
João
Our solution for - let's say - 5 different versions:
Prepare your own intro with randomly generated data (i.e. Intro.Rmd
). Our Intro.Rmd
also saves the generated data frames in a folder named Databases
. Which is then called by each exercise of the correspondent loop (i
).
When rendering rmd files to pdf you must call the right LaTeX packages in your rmd's yaml header. Our case:
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage{wrapfig}
- \usepackage{float}
- \usepackage{colortbl}
- \usepackage{pdflscape}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage{threeparttablex}
- \usepackage[normalem]{ulem}
- \usepackage{makecell}
- \usepackage{xcolor}
Several folders were created:
Intros
);nops_pdf
);subsets
);exams
).The loop:
for (i in 1:5) {
rmarkdown::render(input = "Intro.Rmd",output_file = paste0("Intros/Intro_v",i,".pdf"))
exams2nops(questions, n = 1, nsamp = 1, intro = "Leia as questões com atenção e MARQUE TODAS AS SUAS RESPOSTAS NA FOLHA DE RESPOSTAS! Este exame tem a duração de 60 minutos. Boa sorte!", language = "pt-PT", institution = "Análise Estatística II", title = "Época Normal: Métodos Tipo I - ",dir = "nops_pdf", name = paste0("Ex_AEII_MTI_v",i,"_"), date = "2020-12-01",encoding = "UTF-8", blank = 0, nchoice = 5, duplex = T, reglength = 7L, points = 4, replacement = T,schoice = list(eval = ee))
pdf_subset(input = paste0("nops_pdf/Ex_AEII_MTI_v",i,"_1.pdf"),pages = c(1,3),
output = paste0("subsets/subset_",i,"_part1.pdf"))
pdf_subset(input = paste0("nops_pdf/Ex_AEII_MTI_v",i,"_1.pdf"),pages = c(5:pdf_length(paste0("nops_pdf/Ex_AEII_MTI_v",i,"_1.pdf"))),
output = paste0("subsets/subset_",i,"_part2.pdf"))
pdf_combine(input = c(paste0("subsets/subset_",i,"_part1.pdf"),
paste0("Intros/Intro_v",i,".pdf"),
paste0("subsets/subset_",i,"_part2.pdf")),
output = paste0("exams/exams_v",i,".pdf"))
}
Achim, you say that the pdf generated by the Intro.Rmd
can be merged using exams2nops
, can you exemplify how?