Code for integer partitioning

Provides algorithims for randomly sampling a feasible set defined by a given total and number of elements using integer partitioning.

partitions--Code for integer partitioning

The code in this package is focused on the integer partitioning problem of randomly partitioning some total Q into N parts. These functions solve the main computational challenge of Locey and White (2013) and extend the 'feasible set' approach based on integer partitioning to several ecological patterns and other distributions.

Algorithms were derived by Ken Locey, and coded into R by Dan McGlinn. Ken Locey and Dan McGlinn both work to improve the readability and organization of the code.


rpartitions can be installed directly from git hub using the following R commands.

install_github('partitions', 'klocey', subdir='rpartitions')

or it can be locally installed using



Version 2, June 1991

partitions is a collection of Python coded functions useful for partitioning integers

Copyright (C) Kenneth J. Locey

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1 by Daniel McGlinn, 7 years ago

Browse source code at

Authors: Ken Locey , Daniel McGlinn

Documentation:   PDF Manual  

MIT license

Depends on hash

Suggests testthat

See at CRAN