Description Usage Arguments See Also Examples

This function generates all the permutations of selecting `k`

items from `n`

items.
The results are in lexicographical order.

1 2 3 |

`x` |
an integer or a vector, will be treated as |

`k` |
an integer, the number of items drawn, defaults to |

`n` |
an integer, the total number of items, its value may be implicitly deduced from |

`v` |
a vector to be drawn, defaults to |

`freq` |
an integer vector of item repeat frequencies |

`replace` |
an logical to draw items with replacement |

`layout` |
if "row", "column" or "list" is specified, the returned value would be a "row-major" matrix, a "column-major" matrix or a list respectively |

`nitem` |
number of permutations required, usually used with |

`skip` |
the number of permutations skipped |

`index` |
a vector of indices of the desired permutations |

`nsample` |
sampling random permutations |

`drop` |
vectorize a matrix or unlist a list |

ipermutations for iterating permutations and npermutations to calculate number of permutations

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ```
permutations(3)
permutations(LETTERS[1:3])
# choose 2 from 4
permutations(4, 2)
permutations(LETTERS[1:3], k = 2)
# multiset with frequencies c(2, 3)
permutations(k = 3, freq = c(2, 3))
# with replacement
permutations(4, 2, replace = TRUE)
# column major
permutations(3, layout = "column")
permutations(4, 2, layout = "column")
# list output
permutations(3, layout = "list")
permutations(4, 2, layout = "list")
# specifc range of permutations
permutations(4, 2, nitem = 2, skip = 3)
# specific permutations
permutations(4, 2, index = c(3, 5))
# random permutations
permutations(4, 2, nsample = 3)
# zero sized permutations
dim(permutations(0))
dim(permutations(5, 0))
dim(permutations(5, 6))
dim(permutations(0, 0))
dim(permutations(0, 1))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.