GenRandGroups: Generate Random Groups

View source: R/DescTools.r

GenRandGroupsR Documentation

Generate Random Groups

Description

Generates a random grouping from a given data vector, where the group sizes correspond to the numeric vector grp_n.

Usage

GenRandGroups(x, grp_n)

Arguments

x

a vector containing the objects which should be grouped

grp_n

an integer vector with the required group sizes

Details

For group divisions in class, it is often useful to have a function available that randomizes these divisions.

Value

a list sized length of grp_n with the x elements assigned to their group.

Author(s)

Andri Signorell <andri@signorell.net>

See Also

CombN, CombSet

Examples

# say we have 12 students and want 3 groups with sizes 4,3, and 5

GenRandGroups(x=LETTERS[1:12], grp_n=c(4,3,5))

AndriSignorell/DescTools documentation built on Dec. 1, 2024, 5:13 a.m.