sample_partitions_by_half: Generate Random, Non-Overlapping Partitions of Indices with...

Description Usage Arguments Value

View source: R/sample_partitions_by_half.R

Description

Generate Random, Non-Overlapping Partitions of Indices with Reference vs Rest

Usage

1
sample_partitions_by_half(n, fraction, warn = TRUE)

Arguments

n

Number of elements to partition.

fraction

A numeric of length two in (0,1/2] specifying the size of each partition relative to n, where the first element specifies the "reference" partition and the second the "test" partition. For backward compatible reasons, if of length one, then it's equivalent to specifying fraction = c(reference = 1/2, test = fraction).

warn

If TRUE, a warning is produced if the partitions produced are not of equal size.

Value

A list of two disjoint random non-overlapping partitions where each element holds indices in {1, 2, ..., n}. The first element holds the 'reference' partition and the second the 'test' partition. As an example, if fraction[1] == 1/2, then the reference partition P_0.5 holds n/2 indices and the test partition holds indices in {1, 2, ..., n} \ P_0.5 where the size of the partitions corresponds to the sizes specified by fraction[2].


HenrikBengtsson/TopDomStudy documentation built on May 14, 2021, 1:49 p.m.