| ConstructAnswerSheet {TexExamRandomizer} | R Documentation |
ConstructAnswerSheet
Description
Constructs an answer sheet given a document as generated by StructureDocument by finding in the items the correct and wrong tags and describing where it found them.
Note that you must provide the document part only, StructureDocument gives back a $preamble and $document.
If wrongTag is left NULL, the answer sheet only shows information of the correct answers.
This answer sheet provides information for what answers are correct or incorrect, as well as their position within the original document, before any shuffling was done. (It uses the names of the document to decide whether the document was shuffled or not, since subsetting a list removes all attributes except for the names, this is the "safest" way to do it)
The intent of this function is to make it easy to find the answers for a randomized version of an exam.
Usage
ConstructAnswerSheet(Document, correctTag, wrongTag = NULL)
Arguments
Document |
Document, as defined in |
correctTag |
Tag to identify the correct items. |
wrongTag |
Tag that identifies the wrong items. |
Details
The tags are just command of the type "\Tag" that must be found somewhere that is not commented out inside the last item at the end of the tree structure. Usually you will want to use the tags that already identify the document items for this.
(For example, in the exam class, the tags \choice and \CorrectChoice could be used naturally, without having to introduce extra commands in the document)
Value
Data Frame. With the following columns
- index
Just an index running from 1 to
n, wherenis the numbe of rows- For each layer of depth in the document:
-
Four columns,
<name of section>_originalContains an integer identifying the numbering of this section in the original layer, as identified by the naming convention
<name of section command>_originalContains an integer identifying the numbering of this item in the original section, as identified by the naming convention
<name of section>Contains an integer identifying the numbering of this section in the current layer, as identified by the ordering of the document inputted on this function
<name of section command>Contains an integer identifying the numbering of this item in the current section, as identified by the ordering of the document inputted on this function
- For the last layer of depth
-
5 columns if the wrongTag is not NULL, 4 columns otherwise,
<name of section>_originalContains an integer identifying the numbering of this section in the original layer, as identified by the naming convention
<name of section command>_originalContains an integer identifying the numbering of this item in the original section, as identified by the naming convention
<name of section>Contains an integer identifying the numbering of this section in the current layer, as identified by the ordering of the document inputted on this function
<correctTag>-
Contains an integer identifying the numbering of this item in the current section, , as identified by the ordering of the document inputted on this function
If the
correctTagwasn't found in this item, it will showNAinstead. (This will only happen ifwrongTagis notNULL, since otherwise this elements are omitted) <wrongTag>-
Contains an integer identifying the numbering of this item in the current section, as identified by the ordering of the document inputted on this function
If the
wrongTagwasn't found in this item, it will showNAinstead. (This will only happen ifwrongTagis notNULL, since otherwise this elements are omitted)
See Also
FindExamAnswers for the exact underlying messy algorithm that controls how the table is created.
Other Extracting information:
CountNumberOfSections(),
FindExamAnswers(),
GenerateShortAnswerSheet()
Examples
ConstructAnswerSheet(
TexExamRandomizer::testdoc$document,
"CorrectChoice",
"choice"
)