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

View source: R/ch.getCombinations.r

ch.getCombinationsR 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).

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.

Usage

ch.getCombinations(
  itemSet,
  minNumPerSide = 1,
  maxNumPerSide = 1,
  sample = "all",
  nStimPerGroup = 0,
  includeReverseOrder = TRUE
)

Arguments

minNumPerSide

An integer that specifies the minimum number of items in group. DEFAULT = 1

maxNumPerSide

An integer that specifies the minimum number of items in group. DEFAULT = 1

sample

A string that specifies how to sample the items to create the combinations. The choices are: (1) "byGroup" for each group size (1, 2, etc) the sample size will equal nStimPerGroup; (2) "random" the entire set sample size will equal nStimPerGroup; (3) "all" all the combinations will be generated, without taking a sample (nStimPerGroup is ignored in this case). DEFAULT = "all" The samples will all be drawn randomly without replacement, unless the sample size is greater than the number of possible combinations. In that case the sample will be drawn randomly with replacement.

nStimPerGroup

An integer specifying the number of stim per group to select. If nStimPerGroup == 0, then the program will select all the single trials, and use that total as nStimPerGroup.

includeReverseOrder

A boolean to specify whether the combinations should be copied and the order reversed and added to the output. This is done so that there is not a side bias with the presentation of the items. DEFAULT = TRUE.

data

A vector of items that will be combined.

Value

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

Examples

ch.getCombinations (itemSet = c("item1","item2","item3", "item4"), minNumPerSide = 1, maxNumPerSide = 1, sample = "all", nStimPerGroup = 0, includeReverseOrder = TRUE)

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