Learn R Programming

RcppAlgos (version 2.5.0)

comboGroupsCount: Number of Partitions of a Vector into Groups of Equal Size

Description

Calculate the number of partitions of a vector into groups of equal size. See the related integer sequences A025035-A025042 at OEIS (E.g. A025036 for Number of partitions of 1, 2, ..., 4n into sets of size 4.)

Usage

comboGroupsCount(v, numGroups)

Arguments

v

Source vector. If v is a positive integer, it will be converted to the sequence 1:v. If v is a negative integer, it will be converted to the sequence v:-1. All atomic types are supported (See is.atomic).

numGroups

An Integer. The number of groups that the vector will be partitioned into. Must divide the length of v (if v is a vector) or v (if v is a scalar).

Value

A numerical value representing the total number of partitions of groups of equal size.

References

OEIS Integer Sequence A025036

Examples

Run this code
# NOT RUN {
comboGroupsCount(16, 4)
# }

Run the code above in your browser using DataLab