ch.getRandomCombinations: A function to creates a data frame composed of two sets of...

ch.getRandomCombinationsR Documentation

A function to creates a data frame composed of two sets of combinations (take n items r at a time, order doesn't matter). This function chooses items randomly and effectively handles item modifiers

Description

This function to creates a data frame composed of two sets of combinations. First is creates a data frame for Combination A (take n items r at a time, order doesn't matter). Then it does the same for Combination B. Then it creates data frame that has every possible combination of the rows of each list. This function effectively handles modifiers, but intelligently selecting modifiers and items separately.

Usage

ch.getRandomCombinations(
  df.expItems,
  df.groups,
  numStimPerGroup,
  illegalPatterns = NULL
)

Arguments

df.expItems

A dataframe that contains the item information. The dataframe should contain the following columns: Item, Modifier1, Modifier2, etc. The modifiers are optional and are the possible modifiers for the Item and will be presented in front of the item.

df.groups

A dataframe that has a column for each group (2 groups = 2 columns) and a row for each group size combination. So if you want one item in each group, the dataframe would be data.frame(g1 = c(1), g2 = c(1)). If you want every size combination of 1 and 2 items in each group, you would have: data.frame(g1 = c(1, 2, 1, 2), g2 = c(1, 1, 2, 2))

illegalPatterns

A dataframe that specifies the exact illegal patterns. These patterns, when generated, will be discarded and replaced. If this is NULL, then all generated patterns will be kept. DEFAULT = NULL.

nStimPerGroup

An integer specifying the number of stimuli to sample per group .

Value

dataframe with the all the combinations. The columns are labled IA.# and IB.# to indicate the group.:

Examples

ch.getRandomCombinations (itemSet = c("item1","item2","item3", "item4"), df.groups = data.frame(g1 = c(1, 2, 1, 2), g2 = c(1, 1, 2, 2)), nStimPerGroup = 1000)

ccpluncw/ccpl_R_chValues documentation built on Feb. 12, 2024, 4:21 a.m.