Learn R Programming

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.

Installation

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

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

or it can be locally installed using

library(devtools)
install()

GNU GENERAL PUBLIC LICENSE

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.

Copy Link

Version

Install

install.packages('rpartitions')

Monthly Downloads

11

Version

0.1

License

MIT

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

December 11th, 2013

Functions in rpartitions (0.1)

get_multiplicity

Find the number of times a value k occurs in a partition that is being generated at random by the multiplicity() function. The resulting multiplicity is then passed back to the multiplicity() function along with an updated value of count and an updated dictionary D
get_rand_int

Generate a random integer between two integers
NrParts

Find the number of partitions for a given total Q and number of parts N.
conjugate

Find the conjugate of an integer partition Recoded (orginally on 24-Apr-2013) from the Sage source code: http://www.sagenb.org/src/combinat/partition.py
bottom_up

Bottom up method of generating uniform random partitions of Q having N parts.
multiplicity

multiplicity method of generating uniform random partitions of Q having N parts.
divide_and_conquer

Divide and conquer method of generating uniform random partitions of Q having N parts.
P

Number of partitions of Q with k or less parts.
rand_partitions

Generate uniform random partitions of Q having N parts.
top_down

Top down method of generating uniform random partitions of Q having N parts.
rpartitions

rpartitions
last

Returns the last element of a vector