| read_qti | R Documentation |
These functions read QTI XML from character strings or files. Only the single and multiple choice item types are currently supported.
read_qti(x, ...)
x |
String or connection to QTI XML file. |
... |
further arguments passed to or from other functions. |
read_qti returns an object of class
“qti_item”, which contains the following elements,
if present in x:
id |
item id, extracted from the identifier attribute |
title |
item title, extracted from the title attribute |
type |
item type, currently “ |
prompt |
text for the item stem |
options |
list of text for options |
key |
vector of correct/incorrect as 0/1 for options |
xml |
raw XML contents, stored as an object of class “xml_document” |
# Read from character string
item <- read_qti(
"<assessmentItem identifier='1584'
title='Excellent Example Item'>
<responseDeclaration identifier='RESPONSE' cardinality='single'
baseType='identifier'>
<correctResponse>
<value>ChoiceB</value>
</correctResponse>
</responseDeclaration>
<outcomeDeclaration identifier='SCORE' cardinality='single'
baseType='float'>
<defaultValue><value>0</value></defaultValue>
</outcomeDeclaration>
<itemBody>
<prompt>
<p>Is this a really good question?</p>
</prompt>
<choiceInteraction responseIdentifier='RESPONSE' shuffle='false'
maxChoices='1'>
<simpleChoice identifier='ChoiceA'>Yes</simpleChoice>
<simpleChoice identifier='ChoiceB'>No</simpleChoice>
<simpleChoice identifier='ChoiceC'>Maybe</simpleChoice>
</choiceInteraction>
</itemBody>
</assessmentItem>"
)
item
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.