getSolutionAttributes: Retrieve constraints-related attributes from solution

View source: R/constraint_functions.R

getSolutionAttributesR Documentation

Retrieve constraints-related attributes from solution

Description

getSolutionAttributes is a helper function to retrieve constraints-related attributes from a solution.

Usage

getSolutionAttributes(constraints, item_idx, all_values = FALSE)

Arguments

constraints

a constraints object.

item_idx

item indices from a solution.

all_values

if TRUE, return all values as-is without taking the mean when there are multiple values. If FALSE, return the mean when there are multiple values. This has an effect when there is a constraint on items per stimulus, where there are multiple values of number of items per stimulus. In this case, if TRUE, the number of items for every stimuli are returned as-is. If FALSE, the average number of items across stimuli is returned. (default = FALSE)

Value

  • If all_values == FALSE, getSolutionAttributes returns a data.frame containing constraints data and their associated attributes.

  • If all_values == TRUE, getSolutionAttributes returns a list containing attributes associated to each constraint.

Examples

item_idx <-
  c( 29,  33,  26,  36,  34,
    295, 289, 296, 291, 126,
    133, 124, 134, 129,  38,
     47,  39,  41,  46,  45,
    167, 166, 170, 168, 113,
    116, 119, 117, 118, 114)

getSolutionAttributes(constraints_reading, item_idx, FALSE)
getSolutionAttributes(constraints_reading, item_idx, TRUE)


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