CreateRandomExams {TexExamRandomizer} | R Documentation |
CreateRandomExams
Description
This function creates a series of randomized exams from a tex document and personalizes the information from a table (if a table is given) and a series of command names where thae information shoudl be replaced.
Usage
CreateRandomExams(
x,
layersNames = c("questions", "choices"),
layersCmd = c("question", "(choice|CorrectChoice)"),
outputBaseName,
outputDirectory,
cmdReorder = rep_len(TRUE, length(layersNames)),
sectionReorder = FALSE,
infoTable = NULL,
colNames = NULL,
cmdNames = NULL,
nOutputVersions = nrow(infoTable),
nOutputQuestions = "max",
answerSheetCorrectTag = NULL,
answerSheetWrongTag = NULL,
optionList = NULL
)
Arguments
x |
A character vector, each element represents one line of the latex document |
layersNames |
A character vector, with each element representating the environment name to be searched as |
layersCmd |
A character vector, with the same length as |
outputBaseName |
String, The basename for the output files. |
outputDirectory |
String, The output directory. |
cmdReorder , sectionReorder |
Logical vector, the length of |
infoTable |
Table with information, if NULL, no information is added to the exams |
colNames |
Character vector, Column names from the It first tries to find the column names literally, if ti couldn't find them like that, it will try to use them as a regular expression to find a column that matches the column. |
cmdNames |
Character vector, Names of the commands on the tex file, |
nOutputVersions |
Number of different random versions of the exam to be outputted |
nOutputQuestions |
Number of "questions" on the output exams. If the input is a scalar, the program will decide how to more evenly split the questions between all the sections, otherwise one can directly provide an integer vector specifying how many questions from each section are needed. (this only searches the "items" of the outermost layer) |
answerSheetCorrectTag , answerSheetWrongTag |
If the tags are not given, the output answersheet will be |
optionList |
Instead of writing the options on the function. Options could be given to optionList, and it will add those options. As long as the names are correct |
Details
All the output exams are named with outputBaseName
followed by 00i identifying the number of the exam (The number of zeros is the minimum that allows for all the exams to have a different number) and "_Version_"
followed by the version number of the exam and ".tex
". That is:
<outputDirectory>/<outputBaseName>00i_Version_j.tex
The number of exams outputted will always be the same as the number of versions if no table is given. However, if a table is added as input. It will create one exam for each row of the table, and it will try to divide as evenly as possible how to give the versions between the different rows. (Having one exam for each row, which will probably represent a student)
Value
A list that contains
outputDirectory
The output directory
outputFiles
A character vector that contains all the output names
FullAnswerSheet
The full answer sheet of all the exams.
Each answer sheet is created as described by
ConstructAnswerSheet
, and all the answer sheets are joined together with a version number in front as an added column to bind them all together. The original version has the number 0, all the output versions have sequential numbers as VersionThis wrapper function assumes equal depth on all branches of the tree structure, so that the number of columns is always identical in the answer sheet
See Also
ConstructAnswerSheet
, ReplaceFromTable
, RandomizeDocument
for extra details. . To see examples of how to use it, look at the code in jsonhwparser