burst: Enumerate integer r-vectors summing to n

Description Usage Arguments Value Examples

View source: R/burst.R

Description

Determine all r-vectors with nonnegative integer entries summing to n. Note that this is not intended to be optimized.

Usage

1
burst(n, r = n)

Arguments

n

integer to sum to

r

number of components

Value

a matrix whose rows are the n-tuples

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
burst(4)

burst(4, 4)
burst(4, 3)
burst(4, 2)

rowSums(burst(4))
rowSums(burst(4, 3))
rowSums(burst(4, 2))


burst(10, 4) # all possible 2x2 contingency tables with n=10
burst(10, 4) / 10 # all possible empirical relative frequencies

mpoly documentation built on March 26, 2020, 7:33 p.m.