Learn R Programming

TestDesign (version 1.7.0)

item_attrib-class: Load item attributes

Description

loadItemAttrib is a data loading function for creating an item_attrib object. loadItemAttrib can read item attributes from a data.frame or a .csv file.

Usage

loadItemAttrib(object, pool)

Value

loadItemAttrib returns an item_attrib object.

Arguments

object

item attributes. Can be a data.frame or the file path of a .csv file. The content should at least include an 'ID' column that matches with item IDs (the 'ID' column) of the item_pool object.

pool

an item_pool object. Use loadItemPool for this.

See Also

dataset_science, dataset_reading, dataset_fatigue, dataset_bayes for examples.

Examples

Run this code
## Read from data.frame:
itempool_science   <- loadItemPool(itempool_science_data)
itemattrib_science <- loadItemAttrib(itemattrib_science_data, itempool_science)

## Read from file: write to tempdir() for illustration and clean afterwards
f <- file.path(tempdir(), "itemattrib_science.csv")
write.csv(itemattrib_science_data, f, row.names = FALSE)
itemattrib_science <- loadItemAttrib(f, itempool_science)
file.remove(f)

Run the code above in your browser using DataLab