pairwise_combination_indices | R Documentation |
Fast computation of indices of all pairwise element of a vector of length n.
pairwise_combination_indices(n, self = FALSE)
n |
A number giving the number of elements to create all pairwise indices from |
self |
A logical that determines whether a column should also be multiplied by itself. |
Note that the output order of columns corresponds to the order of the columns in x. First column 1 is multiplied with each of the other columns, then column 2 with the remaining columns etc.
A matrix with n*(n+1)/2 rows (if self=TRUE) or n*(n-1)/2 rows (if self=FALSE, the default) and two columns gicing all possible combinations of indices.
Claus Ekstrom <claus@rprimer.dk>
pairwise_combination_indices(3)
pairwise_combination_indices(4, self=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.