shuffle_with_subgroup_formation function

Compose shuffling function based on already available subgrouping and allocation information

Compose shuffling function based on already available subgrouping and allocation information

shuffle_with_subgroup_formation( subgroup_object, subgroup_allocations, keep_separate_vars = c(), report_grouping_as_attribute = FALSE )

Arguments

  • subgroup_object: A subgrouping object as returned by form_homogeneous_subgroups()
  • subgroup_allocations: A list of possible assignments of the allocation variable as returned by compile_possible_subgroup_allocation()
  • keep_separate_vars: Vector of column names in sample table; items with identical values in those variables will not be put into the same subgroup if at all possible
  • report_grouping_as_attribute: Boolean, if TRUE, add an attribute table to the permutation functions' output, to be used in scoring during the design optimization

Returns

Shuffling function that on each call returns an index vector for a valid sample permutation