Generates all different subsets of size *r* chosen from *n*
different elements.

1 | ```
subsets(n, r, v = 1:n)
``` |

`n` |
numeric. Number of elements to choose from. |

`r` |
numeric. Size of the subsets. |

`v` |
vector. Numeric or character vector of size |

A matrix of dimension (*N x r*), where *N* is
the total number of different combinations of *r* elements chosen
from *n* possible.

This particular version of the function was taken from a message from Bill Venables to ‘r-help’ list on Sun, 17 Dec 2000.

Bill Venables Bill.Venables@cmis.csiro.au

Venables, Bill. "Programmers Note", R-News, Vol 1/1, Jan. 2001. http://cran.r-project.org/doc/Rnews

`combinations`

of the gtools package.

1 2 3 4 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

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.