FindExamAnswers: FindExamAnswers

Description Usage Arguments Details Value See Also

View source: R/AnswerSheets.R


It finds the answer for a certain document, given a correct and wrong tag. The output character vector is a collection of all those matches, with the text identifying the section and item that it was found inside the tree structure.


FindExamAnswers(Document, correctTag, wrongTag = NULL,
  OutputStartingName = "")



Document, as defined in StructureDocument. Remember however that the function StructureDocument returns the document and the preamble together in a list.


String, it should be the name (or regular expression) defining the tag that items that hold a correct answer will have. \<correctTag>.


String, leave as NULL, unless you went the output to explicitly show those questions that are incorrect. Again, it could be a


Internal argument, (it should really be removed after testing that it really does nothing). In theory, this argument starts up the recursive search into the tree for matches. Since the output name will start with this string and a dash afterwards.


In the document, a correct or wrong item should be identified with a tag. Which shall be a latex command. "\correct" "\wrong" or whichever. It must be placed somewhere that is not commented-out. (Similar to how the exam class uses the \CorrectChoice command to identify a correct answer, instead of using a \choice, both tags could be used for this class).

(This is internally used by ConstructAnswerSheet to construct that DF of answers by then parsing the vector output from this function and getting that way the output)

If wrongTag is not null it also provides the information of where a wrong tag is found.

Each output character vectors has a name that identifies all the information necessary to understand where the match was found, relative to both the original document, and the current document we are analizing even if the order of the current document is different.

The name of each element starts with <OutputStartingName>. After that, for each layer that it digs into, it pastes the following name on the right of the name that it already has:


In the last layer, when it finally find the correct or wrong tag. It modifies the <addedname> that should look like i_secName_j_cmdName and it replaces cmdName with the correct or wrong tag respectively.

Therefore, each element is a pretty long string identifying all the layers that it took to traverse to get down to the answer. This function was basically used to prevent the use of attributes that bug out unexpectedly, since when passing functions and parsing things looses the attributes.


Character vector. Each element identifies one match. The text of the element identifies where that match was found, in terms of the path walked on the tree that it took to get here. The naming convention is specified on details.

See Also

Other Extracting information: ConstructAnswerSheet, CountNumberOfSections, GenerateShortAnswerSheet

TexExamRandomizer documentation built on May 2, 2019, 3:18 a.m.