qti_item: The qti_item class

View source: R/qti_item.R

qti_itemR Documentation

The qti_item class

Description

These functions build and manipulate qti_item objects, for analysis and for reading and writing to QTI XML.

Usage

qti_item(
  id = NULL,
  title = NULL,
  type = c("choice"),
  prompt = NULL,
  options = NULL,
  key = NULL,
  rm_prefix = TRUE,
  href = sprintf("qti-item-%s.xml", id),
  xml = NULL
)

Arguments

id

Item ID as an integer or string.

title

Item title, as a string, with max 280 characters.

type

Item type, only "choice" is currently supported.

prompt

Stem text, as a single string.

options

Option text, as vector of strings, one per option.

key

Numeric vector of 0/1 response scores, one per option.

rm_prefix

Logical with default TRUE for removing prefixes, e.g., a., b., c. from prompt and options.

href

Optional file name for item, with default created using id.

xml

Optional XML representation of item, as character. If not supplied, this is created automatically from the remaining arguments.

Value

qti_item returns an object of class “qti_item”, which is a list containing named elements for the item id, title, and type, as supplied via arguments, the prompt and options text with formatting and resources stripped, and the QTI XML representation of the item.

Examples


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)
)
item


talbano/qti documentation built on Jan. 25, 2023, 4:02 a.m.