Learn R Programming

rpartitions (version 0.1)

rand_partitions: Generate uniform random partitions of Q having N parts.

Description

Generate uniform random partitions of Q having N parts.

Usage

rand_partitions(Q, N, sample_size, method = "best", D = hash(), zeros = FALSE, use_c = TRUE, use_hash = FALSE)

Arguments

Q
Total sum across parts
N
Number of parts to sum over
sample_size
number of random partitions to generate
method
: method to use for generating the partition, options include: 'bottom_up', 'top_down', 'divide_and_conquer', 'multiplicity', and 'best'. Defaults to 'best'
D
a dictionary for the number of partitions of Q having N or less parts (or N or less as the largest part), i.e. P(Q, Q + N). Defaults to a blank dictionary.
zeros
boolean if True partitions can have zero values, if False partitions have only positive values, defaults to False
use_c
boolean if TRUE then compiled c code is used, defaults to TRUE
use_hash
boolean, if TRUE then a hash table is used, defaults to FALSE

Value

A matrix where each column is a random partition

Examples

Run this code
rand_partitions(100, 10, 5)

Run the code above in your browser using DataLab