RandomAssignmentGenerator: Random Assignment Generator for a Factorial Experiment with...

View source: R/random_assignment_generator.R

RandomAssignmentGeneratorR Documentation

Random Assignment Generator for a Factorial Experiment with Many Conditions

Description

This function provides a list of random numbers that can be used to assign participants to conditions (cells) in an experiment with many conditions, such as a factorial experiment. The randomization is restricted as follows: if the number of participants available is a multiple of the number of conditions, then cell sizes will be balanced; otherwise, they will be as near balanced as possible.

Usage

RandomAssignmentGenerator(N, C)

Arguments

N

The total number of participants to be randomized.

C

The total number of conditions for the experiment you are planning. Note that f or a complete factorial experiment having k factors, there will be 2^k conditions.

Value

A dataframe with 1 variable ranList with N observations, each observation of ranList provides a random number for each participant. This will be a number from 1 to C. For example, if the 4th number in the list is 7, the 4th subject is randomly assigned to experiment condition 7. Random numbers will be generated so that the experiment is approximately balanced.

Examples

result <- RandomAssignmentGenerator(35,17)
print(result)

MOST documentation built on June 24, 2022, 1:06 a.m.