nPerm: Permutations of a list or a vector

View source: R/nPerm.R

nPermR Documentation

Permutations of a list or a vector

Description

The function returns all possible different permutations of objects in a list or in a vector.

Usage

nPerm(L = c())

Arguments

L

List/Vector

Details

In order to manage permutations of numbers or vectors, the standard permutation process is applied.

Value

list

all the permutations of L

Author(s)

Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it

References

C. A. Charalambides (2002) Enumerative Combinatoris, Chapman & Haii/CRC.

Examples


# permutations of 1,2,3  
nPerm( c(1,2,3) )

# permutations of 1,2,1 (two elements are equal) 
nPerm( c(1,2,1) )

# permutations of the words "Alice", "Bob","Jack"
nPerm( c("Alice", "Bob","Jack") )

# permutations of the vectors c(0,1), c(2,3), c(7,3)
nPerm( list(c(0,1), c(2,3), c(7,3)) )

kStatistics documentation built on June 8, 2022, 5:05 p.m.