trotter (version 0.6)

ppv: Permutations Pseudo-Vector Constructor

Description

The PPV class defines a pseudo-vector containing all the k-permutations of the objects stored in items. The function ppv is a constructor for this class.

Usage

ppv(k, items)

Arguments

k
the number of objects taken at a time.
items
a vector of objects to be permuted.

Value

an instance of PPV.

Details

The arrangement of permutations is similar, but in many cases not identical, to that obtained from the Steinhaus-Johnson-Trotter algorithm (see references).

References

Steinhaus-Johnson-Trotter algorithm. (2014, April 29). In Wikipedia, The Free Encyclopedia. Retrieved 13:24, September 5, 2014

See Also

Combinations Pseudo-Vector cpv

Amalgams Pseudo-Vector apv

Selections Pseudo-Vector spv

Subsets Pseudo-Vector sspv

Examples

Run this code
# create a pseudo-vector of 5-permutations from the first 10 letters
p <- ppv(5, letters[1:10])
# generate a description
print(p)
# compatable with length
length(p)
# inspect a few of the permutations "stored" in p
p[1]
p[1000]
p[30240]

Run the code above in your browser using DataCamp Workspace