##############################################################################
# Packages
library(exams)
library(manacc)
library(writR)
library(lubridate)
library(tibble)
library(dplyr)


##############################################################################
# Initialization
question_id <- "EN00000011"
wdir <- getwd()
parameters <- teachR::param_quest(wdir, question_id, alttype = "open", altlevel = "1 Remember")
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 == "0472 Financial Income Statement and Balance sheet", bloom == "1 Remember")  %>%
  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]

Question

r txt_question_id r quest? r reqexpl r points

if (reqexpl == "") exams::answerlist(questions, markup = "markdown") else writeLines(lines)

Solution

r sol

if (reqexpl == "") exams::answerlist(ifelse(solutions, "True", "False"), explanations, markup = "markdown") else writeLines(c("\\ ","\\ "))

Meta-information

extype: r extype exsolution: r exams::mchoice2string(solutions, single = TRUE) exname: r question_id



NicolasJBM/manacc documentation built on Jan. 16, 2020, 1:42 p.m.