nice_randomize: Easily randomization

View source: R/nice_randomize.R

nice_randomizeR Documentation

Easily randomization

Description

Randomize easily with different designs.

Usage

nice_randomize(
  design = "between",
  Ncondition = 3,
  n = 9,
  condition.names = c("a", "b", "c"),
  col.names = c("id", "Condition")
)

Arguments

design

The design: either between-subject (different groups) or within-subject (repeated-measures on same people).

Ncondition

The number of conditions you want to randomize.

n

The desired sample size. Note that it needs to be a multiple of your number of groups if you are using between.

condition.names

The names of the randomized conditions.

col.names

The desired additional column names for a runsheet.

Value

A dataframe, with participant ID and randomized condition, based on selected design.

See Also

Tutorial: https://rempsyc.remi-theriault.com/articles/randomize

Examples

# Specify design, number of conditions, number of
# participants, and names of conditions:
nice_randomize(
  design = "between", Ncondition = 4, n = 8,
  condition.names = c("BP", "CX", "PZ", "ZL")
)

# Within-Group Design
nice_randomize(
  design = "within", Ncondition = 4, n = 6,
  condition.names = c("SV", "AV", "ST", "AT")
)

# Make a quick runsheet
randomized <- nice_randomize(
  design = "within", Ncondition = 4, n = 128,
  condition.names = c("SV", "AV", "ST", "AT"),
  col.names = c(
    "id", "Condition", "Date/Time",
    "SONA ID", "Age/Gd.", "Handedness",
    "Tester", "Notes"
  )
)
head(randomized)


RemPsyc/rempsyc documentation built on July 2, 2024, 9:41 p.m.