buildConstraints: Build constraints (shortcut to other loading functions)

View source: R/loading_functions.R

buildConstraintsR Documentation

Build constraints (shortcut to other loading functions)

Description

buildConstraints is a data loading function to create a constraints object. buildConstraints is a shortcut that calls other data loading functions. The constraints must be in the expected format; see the vignette in vignette("constraints").

Usage

buildConstraints(
  object,
  item_pool,
  item_attrib,
  st_attrib = NULL,
  pool = NULL,
  constraints = NULL
)

Arguments

object

constraint specifications. Can be a data.frame or the file path of a .csv file. See the vignette for the expected format.

item_pool

item parameters. Can be a item_pool object, a data.frame or the file path of a .csv file.

item_attrib

item attributes. Can be an item_attrib object, a data.frame or the file path of a .csv file.

st_attrib

(optional) stimulus attributes. Can be an st_attrib object, a data.frame or the file path of a .csv file.

pool

(deprecated) use item_pool argument instead.

constraints

(deprecated) use object argument instead.

Value

buildConstraints returns a constraints object. This object is used in Static and Shadow.

Examples

## Read from objects:
constraints_science <- buildConstraints(constraints_science_data,
  itempool_science, itemattrib_science)
constraints_reading <- buildConstraints(constraints_reading_data,
  itempool_reading, itemattrib_reading, stimattrib_reading)

## Read from data.frame:
constraints_science <- buildConstraints(constraints_science_data,
  itempool_science_data, itemattrib_science_data)
constraints_reading <- buildConstraints(constraints_reading_data,
  itempool_reading_data, itemattrib_reading_data, stimattrib_reading_data)

## Read from file: write to tempdir() for illustration and clean afterwards
f1 <- file.path(tempdir(), "constraints_science.csv")
f2 <- file.path(tempdir(), "itempool_science.csv")
f3 <- file.path(tempdir(), "itemattrib_science.csv")
write.csv(constraints_science_data, f1, row.names = FALSE)
write.csv(itempool_science_data   , f2, row.names = FALSE)
write.csv(itemattrib_science_data , f3, row.names = FALSE)
constraints_science <- buildConstraints(f1, f2, f3)
file.remove(f1)
file.remove(f2)
file.remove(f3)

TestDesign documentation built on Feb. 16, 2023, 7:19 p.m.