knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The qti package provides functions for reading and writing QTI XML files in R, so as to support the analysis of assessment item content. These functions implement XML parsing from the xml2 package.
QTI, question and test interoperability, is a complex XML standard for storing and sharing assessment information and results. The qti package aims to cover the simpler QTI item interactions, currently single and multiple choice, along with assessment manifest files. QTI files can also be built from scratch, as shown below.
Install qti from github with:
# install.packages("devtools") devtools::install_github("talbano/qti")
Here, we build a basic multiple choice assessment item from scratch, write to a temporary QTI file, and read back in.
## Load package library("qti") ## Build an item from scratch item <- qti_item( id = 999, title = "Example Item", type = "choice", prompt = "What does this image tell you? <img src='life.png' />", options = c("Everything", "Something", "Nothing, but look at this code:<br/><pre>lm(life ~ R)</pre>"), key = c(1, 1, 0) ) ## Default view is parsed text, with HTML formatting removed and ## placeholders added for any images, tables, math, and code item ## Write to file temp <- tempfile(fileext = ".qti") write_qti(item, temp) readLines(temp) ## Read as QTI read_qti(temp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.