############################################################################## # Packages library(exams) library(manacc) library(writR) library(lubridate) library(tibble) library(dplyr) ############################################################################## # Initialization question_id <- "EN00000006" wdir <- getwd() parameters <- teachR::param_quest(wdir, question_id, alttype = "open", altlevel = "2 Understand") for (i in 1:length(parameters)) assign(names(parameters)[[i]], parameters[[i]]) options(xtable.comment = FALSE, xtable.floating = FALSE, xtable.timestamp = "") set.seed(seed) ############################################################################## # Preparation selection <- manacc::ma_open %>% dplyr::filter(subsection == "0431 Causality and homogeneity", bloom == "2 Understand") %>% dplyr::sample_n(1) quest <- selection$question[[1]] sol <- selection$answer[[1]] ############################################################################## # Answers if (reqexpl != "" & exasolu == "exam" & type_table != "html") lines <- paste0("\\vspace{",selection$space[[1]],"cm}") else lines <- rep(" \\ ", 2) #lines <- rep("\\ ", 2) questions <- c( right1 = "", wrong1 = "", wrong2 = "", wrong3 = "", wrong4 = "", wrong5 = "" ) solutions <- c(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE) explanations <- c( "", "", "", "", "", "" ) ############################################################################## # Randomize order (do not edit) alea <- sample(c(1, sample(2:length(questions), (alternatives-1))), alternatives) questions <- questions[alea] solutions <- solutions[alea] explanations <- explanations[alea]
r txt_question_id
r quest
? r reqexpl
r points
if (reqexpl == "") exams::answerlist(questions, markup = "markdown") else writeLines(lines)
r sol
if (reqexpl == "") exams::answerlist(ifelse(solutions, "True", "False"), explanations, markup = "markdown") else writeLines(c("\\ ","\\ "))
extype: r extype
exsolution: r exams::mchoice2string(solutions, single = TRUE)
exname: r question_id
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.