Description Usage Arguments Value Note Author(s) References See Also Examples
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 desired 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.
Documentation based on subsets.Rd file in package BHH2 by Ernesto Barrios.
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 |
Attaching package: 'CombMSC'
The following object is masked from 'package:stats':
BIC
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 1 2 4
[3,] 1 2 5
[4,] 1 3 4
[5,] 1 3 5
[6,] 1 4 5
[7,] 2 3 4
[8,] 2 3 5
[9,] 2 4 5
[10,] 3 4 5
[,1] [,2] [,3]
[1,] "a" "b" "c"
[2,] "a" "b" "d"
[3,] "a" "b" "e"
[4,] "a" "c" "d"
[5,] "a" "c" "e"
[6,] "a" "d" "e"
[7,] "b" "c" "d"
[8,] "b" "c" "e"
[9,] "b" "d" "e"
[10,] "c" "d" "e"
[,1] [,2] [,3]
[1,] 10 20 30
[2,] 10 20 50
[3,] 10 20 80
[4,] 10 30 50
[5,] 10 30 80
[6,] 10 50 80
[7,] 20 30 50
[8,] 20 30 80
[9,] 20 50 80
[10,] 30 50 80
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.