Learn R Programming

ggdmcModel (version 0.2.9.0)

build_cell_names_r: Find All Possible Conditions

Description

Constructs all possible condition combinations (i.e., cells) based on experimental factors, parameter mappings, and response definitions. Returns both cell names and sorted factor definitions.

Usage

build_cell_names_r(parameter_map_r, factors_r, responses_r)

Value

An Rcpp::List with two elements:

  • cell_names: Character vector of all possible condition combinations

  • sortedFactors: The processed factor structure used to generate cells

Arguments

parameter_map_r

An Rcpp::List where each element is a character vector mapping parameters to conditions. Names should correspond to parameters.

factors_r

An Rcpp::List where each element is a character vector of factor levels. Names should correspond to factor names.

responses_r

A character vector (std::vector<std::string>) of response/accumulator names.

Typical Workflow

This function is typically used to:

  1. Establish the full experimental design space

  2. Verify factor/parameter compatibility

  3. Generate condition labels for model specification

This function primarily is to debug the internal process of model building.

Details

The function:

  1. Converts R lists to 'C++' maps for efficient processing

  2. Generates all condition combinations via Cartesian product

  3. Handles special parameter mappings (like mapping accumulators to conditions)

  4. Returns both cell names and the factor structure used

Examples

Run this code
# A simple example
p_map <- list(A = "1", B = "1", t0 = "1", mean_v = "M", sd_v = "1",
               st0 ="1")
factors <- list(S = c("s1", "s2"))
responses <- c("r1", "r2")
result <- build_cell_names_r(p_map, factors, responses)

# cat("B (2 factors), t0, mean_v (3 factors), sd_v (2 factors)")
p_map <- list(
    A = "H", B = c("S", "G"), t0 = "E", mean_v = c("D", "H", "M"),
    sd_v = c("D", "M"), st0 = "1"
)
factors <- list(
    S = c("s1", "s2", "s3"), D = c("d1", "d2"), E = c("e1", "e2"),
    G = c("g1", "g2", "g3"), H = c("h1", "h2", "h3", "h4", "h5")
)
responses <- c("r1", "r2", "r3")
result <- build_cell_names_r(p_map, factors, responses)

Run the code above in your browser using DataLab