permute {crank} | R Documentation |

## Permute a vector.

### Description

Permute the values contained in a vector.

### Usage

```
permute(x)
```

### Arguments

`x` |
The vector of values that are to be permuted. |

### Details

‘permute’ calculates the number of permutations and creates a matrix with that number of rows. It fills the first column with the elements of ‘x’ in groups large enough to cover the permutations of a vector with one less value. It then fills the remaining columns by calling itself with all values except the one in the first row of the current block. If ‘x’ has only two values, it returns the trivial permutation of ‘x’ and its reverse.

### Value

A matrix in which each row is a permutation of the values in ‘x’.

### Author(s)

Jim Lemon

### See Also

### Examples

```
permute(c(5,8,3,9))
```

[Package

*crank*version 1.1-2 Index]